Skip to content
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

fix(server): local_addr() with executor (0.12) #2009

Merged
merged 1 commit into from Nov 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 4 additions & 3 deletions examples/single_threaded.rs
Expand Up @@ -37,14 +37,15 @@ fn main() {

let server = Server::bind(&addr)
.executor(exec)
.serve(new_service)
.map_err(|e| eprintln!("server error: {}", e));
.serve(new_service);

println!("Listening on http://{}", addr);

assert_eq!(addr, server.local_addr());

current_thread::Runtime::new()
.expect("rt new")
.spawn(server)
.spawn(server.map_err(|e| eprintln!("server error: {}", e)))
.run()
.expect("rt run");
}
Expand Down
2 changes: 1 addition & 1 deletion src/server/mod.rs
Expand Up @@ -133,7 +133,7 @@ impl Server<AddrIncoming, ()> {
}

#[cfg(feature = "runtime")]
impl<S> Server<AddrIncoming, S> {
impl<S, E> Server<AddrIncoming, S, E> {
/// Returns the local address that this server is bound to.
pub fn local_addr(&self) -> SocketAddr {
self.spawn_all.local_addr()
Expand Down