You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have an HTTP connection that gets upgraded and later sent onto a bounded channel (async_channel) if the channel is full (which is most likely).
While the sender.send is blocked (in an async manner), I need to monitor upgraded - if the client sends any data or closes the connection, then the sender.send must be canceled.
Is there a way to do this without wrapping upgraded with Arc and Mutex?
match hyper::upgrade::on(req).await{Ok(upgraded) => {debug!("CONNECT upgrade succcessfuly");let svc = "foo";// TODOlet sender = c.grab_sender(svc.to_string()).unwrap();debug!("waiting on send");
tokio::select! {
send = sender.send(Conn{stream: upgraded}) => {match send {Ok(_)=> debug!("connect send succcessfuly"),
Err(err)=>error!("failed to send CONNECT seocket: {}",err),
}},
// TODO: if the 'upgraded' is closed by client, cancel the send}}
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have an HTTP connection that gets upgraded and later sent onto a bounded channel (async_channel) if the channel is full (which is most likely).
While the
sender.send
is blocked (in an async manner), I need to monitorupgraded
- if the client sends any data or closes the connection, then thesender.send
must be canceled.Is there a way to do this without wrapping
upgraded
withArc
andMutex
?Beta Was this translation helpful? Give feedback.
All reactions