mirror of
https://github.com/YGGverse/aquatic.git
synced 2026-04-02 10:45:30 +00:00
ws: don't yield unnecessarily in run_in_message_loop, improve logging
This commit is contained in:
parent
d48deeff8c
commit
579fcb2140
2 changed files with 7 additions and 9 deletions
|
|
@ -20,7 +20,7 @@ use futures_rustls::TlsAcceptor;
|
||||||
use glommio::channels::channel_mesh::Senders;
|
use glommio::channels::channel_mesh::Senders;
|
||||||
use glommio::channels::local_channel::{LocalReceiver, LocalSender};
|
use glommio::channels::local_channel::{LocalReceiver, LocalSender};
|
||||||
use glommio::net::TcpStream;
|
use glommio::net::TcpStream;
|
||||||
use glommio::timer::{sleep, timeout};
|
use glommio::timer::timeout;
|
||||||
use glommio::{enclose, prelude::*};
|
use glommio::{enclose, prelude::*};
|
||||||
use hashbrown::hash_map::Entry;
|
use hashbrown::hash_map::Entry;
|
||||||
use hashbrown::HashMap;
|
use hashbrown::HashMap;
|
||||||
|
|
@ -214,12 +214,6 @@ struct ConnectionReader<S> {
|
||||||
impl<S: futures::AsyncRead + futures::AsyncWrite + Unpin> ConnectionReader<S> {
|
impl<S: futures::AsyncRead + futures::AsyncWrite + Unpin> ConnectionReader<S> {
|
||||||
async fn run_in_message_loop(&mut self) -> anyhow::Result<()> {
|
async fn run_in_message_loop(&mut self) -> anyhow::Result<()> {
|
||||||
loop {
|
loop {
|
||||||
while self.out_message_sender.is_full() {
|
|
||||||
sleep(Duration::from_millis(100)).await;
|
|
||||||
|
|
||||||
yield_if_needed().await;
|
|
||||||
}
|
|
||||||
|
|
||||||
let message = self
|
let message = self
|
||||||
.ws_in
|
.ws_in
|
||||||
.next()
|
.next()
|
||||||
|
|
|
||||||
|
|
@ -287,10 +287,14 @@ async fn receive_out_messages(
|
||||||
match reference.out_message_sender.try_send((meta, out_message)) {
|
match reference.out_message_sender.try_send((meta, out_message)) {
|
||||||
Ok(()) => {}
|
Ok(()) => {}
|
||||||
Err(GlommioError::Closed(_)) => {}
|
Err(GlommioError::Closed(_)) => {}
|
||||||
Err(GlommioError::WouldBlock(_)) => {}
|
Err(GlommioError::WouldBlock(_)) => {
|
||||||
|
::log::debug!(
|
||||||
|
"couldn't send OutMessage over local channel to Connection, channel full"
|
||||||
|
);
|
||||||
|
}
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
::log::debug!(
|
::log::debug!(
|
||||||
"Couldn't send out_message from shared channel to local receiver: {:?}",
|
"couldn't send OutMessage over local channel to Connection: {:?}",
|
||||||
err
|
err
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue