split 2 of 772644f, debugging ci

This commit is contained in:
17ms 2023-05-01 16:34:53 +03:00
parent f8e2806406
commit e1af665a65

View File

@ -184,11 +184,35 @@ impl Connector {
) -> Result<(), Box<dyn Error + Send + Sync>> { ) -> Result<(), Box<dyn Error + Send + Sync>> {
loop { loop {
let rx_msg = rx.recv().await; let rx_msg = rx.recv().await;
if rx_msg.is_none() {
continue;
}
match rx_msg.unwrap() { match self.msg_handler(rx_msg.unwrap(), conn, metadata).await {
Ok(true) => continue,
Ok(false) => break,
Err(e) => return Err(e),
}
}
Ok(())
}
async fn msg_handler(
&self,
msg: Message,
conn: &mut Connection<'_>,
metadata: &HashMap<String, (u64, String)>,
) -> Result<bool, Box<dyn Error + Send + Sync>> {
match msg {
Message::ClientReq(name) => { Message::ClientReq(name) => {
let req = Request::new(name, metadata).unwrap(); // TODO: handle let req = match Request::new(name, metadata) {
Some(req) => req,
None => return Ok(true),
};
self.request(conn, req).await?; self.request(conn, req).await?;
Ok(true)
} }
Message::Shutdown => { Message::Shutdown => {
let msg = b"DISCONNECT".to_vec(); let msg = b"DISCONNECT".to_vec();
@ -200,12 +224,9 @@ impl Connector {
) )
.await?; .await?;
break; Ok(false)
} }
_ => continue, _ => Ok(true),
} }
} }
Ok(())
}
} }