-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Update hyper to latest nightly #324
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 3 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4ad95be
fix(rustup): update lifetime bounds
renato-zannon bf6a51a
fix(rustup): use module-level thread functions
renato-zannon c76fa20
fix(rustup): update feature flags
renato-zannon 3217b8d
feat(server): make AcceptorPool::accept() block and allow non'-static…
renato-zannon 40f3042
fix(rustup): Fix signature of IntoCow
renato-zannon 1fd8c26
fix(rustup): Remove uses of the obsolete &a[] syntax
renato-zannon ad70106
fix(rustup): Add PhantomData markers to phantom type users
renato-zannon e36c1b8
fix(rustup): Extend now takes an IntoIterator
renato-zannon 124a31f
fix(rustup): CowString is gone
renato-zannon File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#![feature(core, io, test)] | ||
#![feature(core, old_io, test)] | ||
extern crate hyper; | ||
|
||
extern crate test; | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#![feature(io, test)] | ||
#![feature(old_io, test)] | ||
extern crate hyper; | ||
extern crate test; | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#![feature(env, io)] | ||
#![feature(env, old_io)] | ||
extern crate hyper; | ||
|
||
use std::env; | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#![feature(io)] | ||
#![feature(old_io)] | ||
extern crate hyper; | ||
|
||
use std::old_io::net::ip::Ipv4Addr; | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
#![feature(io)] | ||
#![feature(old_io)] | ||
extern crate hyper; | ||
#[macro_use] extern crate log; | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
use std::thread::{Thread, JoinGuard}; | ||
use std::thread::{self, JoinGuard}; | ||
use std::sync::Arc; | ||
use std::sync::mpsc; | ||
use net::NetworkAcceptor; | ||
|
@@ -7,7 +7,7 @@ pub struct AcceptorPool<A: NetworkAcceptor> { | |
acceptor: A | ||
} | ||
|
||
impl<A: NetworkAcceptor> AcceptorPool<A> { | ||
impl<A: NetworkAcceptor + 'static> AcceptorPool<A> { | ||
/// Create a thread pool to manage the acceptor. | ||
pub fn new(acceptor: A) -> AcceptorPool<A> { | ||
AcceptorPool { acceptor: acceptor } | ||
|
@@ -18,9 +18,8 @@ impl<A: NetworkAcceptor> AcceptorPool<A> { | |
/// ## Panics | ||
/// | ||
/// Panics if threads == 0. | ||
pub fn accept<F: Fn(A::Stream) + Send + Sync>(self, | ||
work: F, | ||
threads: usize) -> JoinGuard<'static, ()> { | ||
pub fn accept<F>(self, work: F, threads: usize) -> JoinGuard<'static, ()> | ||
where F: Fn(A::Stream) + Send + Sync + 'static { | ||
assert!(threads != 0, "Can't accept on 0 threads."); | ||
|
||
// Replace with &F when Send changes land. | ||
|
@@ -35,16 +34,16 @@ impl<A: NetworkAcceptor> AcceptorPool<A> { | |
for _ in 0..threads { spawn() } | ||
|
||
// Spawn the supervisor | ||
Thread::scoped(move || for () in supervisor_rx.iter() { spawn() }) | ||
thread::scoped(move || for () in supervisor_rx.iter() { spawn() }) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To make this blocking we'd just remove the |
||
} | ||
} | ||
|
||
fn spawn_with<A, F>(supervisor: mpsc::Sender<()>, work: Arc<F>, mut acceptor: A) | ||
where A: NetworkAcceptor, | ||
F: Fn(<A as NetworkAcceptor>::Stream) + Send + Sync { | ||
where A: NetworkAcceptor + 'static, | ||
F: Fn(<A as NetworkAcceptor>::Stream) + Send + Sync + 'static { | ||
use std::old_io::EndOfFile; | ||
|
||
Thread::spawn(move || { | ||
thread::spawn(move || { | ||
let sentinel = Sentinel::new(supervisor, ()); | ||
|
||
loop { | ||
|
@@ -83,7 +82,7 @@ impl<T: Send> Sentinel<T> { | |
} | ||
|
||
#[unsafe_destructor] | ||
impl<T: Send> Drop for Sentinel<T> { | ||
impl<T: Send + 'static> Drop for Sentinel<T> { | ||
fn drop(&mut self) { | ||
// If we were cancelled, get out of here. | ||
if !self.active { return; } | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Additional advantage of making this blocking:
'a
here instead of'static
, so this can be used with non-'static data.