mirror of https://github.com/rwf2/Rocket.git
Display the port that was resolved, not configured.
This commit is contained in:
parent
0d18faf91e
commit
41386cfb78
|
@ -39,3 +39,6 @@ members = [
|
||||||
"examples/raw_sqlite",
|
"examples/raw_sqlite",
|
||||||
"examples/hello_tls",
|
"examples/hello_tls",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[replace]
|
||||||
|
"hyper:0.10.8" = { git = 'https://github.com/SergioBenitez/hyper', branch = "0.10.x" }
|
||||||
|
|
|
@ -22,7 +22,6 @@ tls = ["rustls", "hyper-rustls"]
|
||||||
term-painter = "0.2"
|
term-painter = "0.2"
|
||||||
log = "0.3"
|
log = "0.3"
|
||||||
url = "1"
|
url = "1"
|
||||||
hyper = { version = "0.10.4", default-features = false }
|
|
||||||
toml = { version = "0.2", default-features = false }
|
toml = { version = "0.2", default-features = false }
|
||||||
num_cpus = "1"
|
num_cpus = "1"
|
||||||
state = "0.2.1"
|
state = "0.2.1"
|
||||||
|
@ -35,6 +34,12 @@ pear_codegen = "0.0.8"
|
||||||
rustls = { version = "0.5.8", optional = true }
|
rustls = { version = "0.5.8", optional = true }
|
||||||
cookie = { version = "0.7.4", features = ["percent-encode", "secure"] }
|
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]
|
[dependencies.hyper-rustls]
|
||||||
git = "https://github.com/SergioBenitez/hyper-rustls"
|
git = "https://github.com/SergioBenitez/hyper-rustls"
|
||||||
default-features = false
|
default-features = false
|
||||||
|
|
|
@ -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 {
|
impl fmt::Display for LaunchErrorKind {
|
||||||
#[inline]
|
#[inline]
|
||||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
|
|
@ -601,15 +601,20 @@ impl Rocket {
|
||||||
|
|
||||||
let full_addr = format!("{}:{}", self.config.address, self.config.port);
|
let full_addr = format!("{}:{}", self.config.address, self.config.port);
|
||||||
serve!(self, &full_addr, |server, proto| {
|
serve!(self, &full_addr, |server, proto| {
|
||||||
let server = match server {
|
let mut server = match server {
|
||||||
Ok(server) => server,
|
Ok(server) => server,
|
||||||
Err(e) => return LaunchError::from(e)
|
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!("🚀 {} {}{}",
|
launch_info!("🚀 {} {}{}",
|
||||||
White.paint("Rocket has launched from"),
|
White.paint("Rocket has launched from"),
|
||||||
White.bold().paint(proto),
|
White.bold().paint(proto),
|
||||||
White.bold().paint(&full_addr));
|
White.bold().paint(&format!("{}:{}", addr, port)));
|
||||||
|
|
||||||
let threads = self.config.workers as usize;
|
let threads = self.config.workers as usize;
|
||||||
if let Err(e) = server.handle_threads(self, threads) {
|
if let Err(e) = server.handle_threads(self, threads) {
|
||||||
|
|
Loading…
Reference in New Issue