wampire
wampire copied to clipboard
Panic when client connects to host which is not listenning
The call to connect()
ends up calling unwrap()
which makes the program panic.
Client code :
let mut client = match connection.connect() {
Ok(c) => c,
Err(e) => {
return Err(ProjectError::ConnectionFailed(format!("{}",e)))
},
};
Log output
[2019-12-26T20:05:13Z ERROR ws::handler] WS Error <Io(Os { code: 10061, kind: ConnectionRefused, message: "No connection could be made because the target machine actively refused it." })>
[2019-12-26T20:05:13Z TRACE ws::io] WebSocket connection to token=Token(0) disconnected.
[2019-12-26T20:05:13Z TRACE ws::io] Active connections 0
[2019-12-26T20:05:13Z DEBUG ws::io] Shutting down websocket client.
[2019-12-26T20:05:13Z DEBUG ws::factory] Factory received WebSocket shutdown request.
[2019-12-26T20:05:13Z TRACE mio::poll] deregistering handle with poller
[2019-12-26T20:05:13Z TRACE mio::poll] deregistering handle with poller
[2019-12-26T20:05:13Z TRACE mio::poll] deregistering handle with poller
[2019-12-26T20:05:13Z DEBUG wampire::client] Result of connection: Ok(())
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: RecvError', src\libcore\result.rs:1165:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.