|
|
@ -63,6 +63,7 @@ use tungstenite::{ |
|
|
|
handshake::{ |
|
|
|
handshake::{ |
|
|
|
client::{ClientHandshake, Response}, |
|
|
|
client::{ClientHandshake, Response}, |
|
|
|
server::{Callback, NoCallback}, |
|
|
|
server::{Callback, NoCallback}, |
|
|
|
|
|
|
|
HandshakeError, |
|
|
|
}, |
|
|
|
}, |
|
|
|
protocol::{Message, Role, WebSocket, WebSocketConfig}, |
|
|
|
protocol::{Message, Role, WebSocket, WebSocketConfig}, |
|
|
|
server, |
|
|
|
server, |
|
|
@ -118,11 +119,12 @@ where |
|
|
|
let cli_handshake = ClientHandshake::start(allow_std, request, config)?; |
|
|
|
let cli_handshake = ClientHandshake::start(allow_std, request, config)?; |
|
|
|
cli_handshake.handshake() |
|
|
|
cli_handshake.handshake() |
|
|
|
}); |
|
|
|
}); |
|
|
|
f.await.map_err(|e| { |
|
|
|
f.await.map_err(|e| match e { |
|
|
|
WsError::Io(std::io::Error::new( |
|
|
|
HandshakeError::Failure(e) => e, |
|
|
|
|
|
|
|
e => WsError::Io(std::io::Error::new( |
|
|
|
std::io::ErrorKind::Other, |
|
|
|
std::io::ErrorKind::Other, |
|
|
|
e.to_string(), |
|
|
|
e.to_string(), |
|
|
|
)) |
|
|
|
)), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -183,11 +185,12 @@ where |
|
|
|
let f = handshake::server_handshake(stream, move |allow_std| { |
|
|
|
let f = handshake::server_handshake(stream, move |allow_std| { |
|
|
|
server::accept_hdr_with_config(allow_std, callback, config) |
|
|
|
server::accept_hdr_with_config(allow_std, callback, config) |
|
|
|
}); |
|
|
|
}); |
|
|
|
f.await.map_err(|e| { |
|
|
|
f.await.map_err(|e| match e { |
|
|
|
WsError::Io(std::io::Error::new( |
|
|
|
HandshakeError::Failure(e) => e, |
|
|
|
|
|
|
|
e => WsError::Io(std::io::Error::new( |
|
|
|
std::io::ErrorKind::Other, |
|
|
|
std::io::ErrorKind::Other, |
|
|
|
e.to_string(), |
|
|
|
e.to_string(), |
|
|
|
)) |
|
|
|
)), |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|