Make constructors error less
This commit is contained in:
parent
f08c251bd1
commit
9451920c52
3 changed files with 4 additions and 4 deletions
|
|
@ -160,7 +160,7 @@ impl ConnMaintenance {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn new(stream: WsStream, ping_delay: Duration) -> Result<(ConnTx, ConnRx, ConnMaintenance)> {
|
||||
pub fn new(stream: WsStream, ping_delay: Duration) -> (ConnTx, ConnRx, ConnMaintenance) {
|
||||
let (ws_tx, ws_rx) = stream.split();
|
||||
let (tx, rx) = mpsc::unbounded_channel();
|
||||
let last_ping_payload = Arc::new(Mutex::new(vec![]));
|
||||
|
|
@ -178,5 +178,5 @@ pub fn new(stream: WsStream, ping_delay: Duration) -> Result<(ConnTx, ConnRx, Co
|
|||
last_ping_payload,
|
||||
};
|
||||
|
||||
Ok((conn_tx, conn_rx, conn_maintenance))
|
||||
(conn_tx, conn_rx, conn_maintenance)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -346,7 +346,7 @@ impl Server {
|
|||
async fn handle_conn(&self, stream: TcpStream) -> anyhow::Result<()> {
|
||||
let stream = MaybeTlsStream::Plain(stream);
|
||||
let stream = tokio_tungstenite::accept_async(stream).await?;
|
||||
let (tx, rx, maintenance) = conn::new(stream, Duration::from_secs(10))?;
|
||||
let (tx, rx, maintenance) = conn::new(stream, Duration::from_secs(10));
|
||||
tokio::try_join!(self.greet_and_run(tx, rx), Self::maintain(maintenance))?;
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -257,7 +257,7 @@ impl CoveConnMt {
|
|||
timeout: Duration,
|
||||
) -> Result<(ConnTx, ConnRx, ConnMaintenance), conn::Error> {
|
||||
let stream = tokio_tungstenite::connect_async(url).await?.0;
|
||||
let conn = conn::new(stream, timeout)?;
|
||||
let conn = conn::new(stream, timeout);
|
||||
Ok(conn)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue