mirror of
https://github.com/cccb/servicepoint.git
synced 2025-01-18 10:00:14 +01:00
remove Arc from WebSocket Connection
This commit is contained in:
parent
bb34541077
commit
3d74bfe05e
|
@ -34,13 +34,11 @@ pub enum Connection {
|
|||
/// [servicepoint-websocket-relay]: https://github.com/kaesaecracker/servicepoint-websocket-relay
|
||||
#[cfg(feature = "protocol_websocket")]
|
||||
WebSocket(
|
||||
std::sync::Arc<
|
||||
std::sync::Mutex<
|
||||
tungstenite::WebSocket<
|
||||
tungstenite::stream::MaybeTlsStream<std::net::TcpStream>,
|
||||
>,
|
||||
>,
|
||||
>,
|
||||
),
|
||||
|
||||
/// A fake connection for testing that does not actually send anything.
|
||||
|
@ -109,9 +107,9 @@ impl Connection {
|
|||
|
||||
let request = ClientRequestBuilder::new(uri).into_client_request()?;
|
||||
let (sock, _) = connect(request)?;
|
||||
Ok(Self::WebSocket(std::sync::Arc::new(std::sync::Mutex::new(
|
||||
Ok(Self::WebSocket(std::sync::Mutex::new(
|
||||
sock,
|
||||
))))
|
||||
)))
|
||||
}
|
||||
|
||||
/// Send something packet-like to the display. Usually this is in the form of a Command.
|
||||
|
@ -163,7 +161,7 @@ impl Drop for Connection {
|
|||
if let Connection::WebSocket(sock) = self {
|
||||
_ = sock
|
||||
.try_lock()
|
||||
.map(move |mut sock| sock.close(None).unwrap());
|
||||
.map(move |mut sock| sock.close(None));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue