Display the port that was resolved, not configured.

This commit is contained in:
Sergio Benitez 2017-04-19 02:23:06 -07:00
parent 0d18faf91e
commit 41386cfb78
4 changed files with 23 additions and 3 deletions

View File

@ -39,3 +39,6 @@ members = [
"examples/raw_sqlite",
"examples/hello_tls",
]
[replace]
"hyper:0.10.8" = { git = 'https://github.com/SergioBenitez/hyper', branch = "0.10.x" }

View File

@ -22,7 +22,6 @@ tls = ["rustls", "hyper-rustls"]
term-painter = "0.2"
log = "0.3"
url = "1"
hyper = { version = "0.10.4", default-features = false }
toml = { version = "0.2", default-features = false }
num_cpus = "1"
state = "0.2.1"
@ -35,6 +34,12 @@ pear_codegen = "0.0.8"
rustls = { version = "0.5.8", optional = true }
cookie = { version = "0.7.4", features = ["percent-encode", "secure"] }
[dependencies.hyper]
git = "https://github.com/SergioBenitez/hyper"
branch = "0.10.x"
version = "0.10.4"
default-features = false
[dependencies.hyper-rustls]
git = "https://github.com/SergioBenitez/hyper-rustls"
default-features = false

View File

@ -130,6 +130,13 @@ impl From<hyper::Error> for LaunchError {
}
}
impl From<io::Error> for LaunchError {
#[inline]
fn from(error: io::Error) -> LaunchError {
LaunchError::new(LaunchErrorKind::Io(error))
}
}
impl fmt::Display for LaunchErrorKind {
#[inline]
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {

View File

@ -601,15 +601,20 @@ impl Rocket {
let full_addr = format!("{}:{}", self.config.address, self.config.port);
serve!(self, &full_addr, |server, proto| {
let server = match server {
let mut server = match server {
Ok(server) => server,
Err(e) => return LaunchError::from(e)
};
let (addr, port) = match server.local_addr() {
Ok(server_addr) => (&self.config.address, server_addr.port()),
Err(e) => return LaunchError::from(e)
};
launch_info!("🚀 {} {}{}",
White.paint("Rocket has launched from"),
White.bold().paint(proto),
White.bold().paint(&full_addr));
White.bold().paint(&format!("{}:{}", addr, port)));
let threads = self.config.workers as usize;
if let Err(e) = server.handle_threads(self, threads) {