first step towards less cpu usage

This commit is contained in:
Luuk van Oijen
2023-11-13 12:33:15 +01:00
parent b5c6f2c3c7
commit f2b9384447
5 changed files with 149 additions and 48 deletions

View File

@@ -324,6 +324,13 @@ impl Client {
Ok(None)
}
pub async fn process_blocking(&mut self) -> anyhow::Result<Option<RawPacket>> {
if let Some(packet) = self.read_packet_waiting().await? {
return Ok(Some(packet));
}
Ok(None)
}
pub fn disconnect(&mut self) {
self.state = ClientState::Disconnect;
}