server side preparation

This commit is contained in:
2026-02-18 21:52:22 -05:00
parent 1c6b6de8f6
commit 6fad5b1852
15 changed files with 547 additions and 535 deletions

View File

@@ -1,5 +1,5 @@
use openworm::net::{
ClientRequestMsg, RecvHandler, RequestId, SERVER_NAME, SendResult, ServerMsg, ServerRespMsg,
ClientMsgInst, RecvHandler, RequestId, SERVER_NAME, SendResult, ServerMsg, ServerMsgInst,
recv_uni, send_uni,
};
use quinn::{
@@ -65,9 +65,9 @@ impl ClientSender {
}
pub async fn send(&self, msg: impl Into<ServerMsg>) -> SendResult {
let msg = ServerRespMsg {
let msg = ServerMsgInst {
id: None,
msg: msg.into().into(),
msg: msg.into(),
};
send_uni(&self.conn, msg).await
}
@@ -79,12 +79,12 @@ pub struct ClientReplier {
}
impl ClientReplier {
pub async fn send(&self, msg: impl Into<ServerMsg>) -> SendResult {
let msg = ServerRespMsg {
pub async fn send(&self, msg: impl Into<ServerMsg>) {
let msg = ServerMsgInst {
id: Some(self.req_id),
msg: msg.into().into(),
msg: msg.into(),
};
send_uni(&self.conn, msg).await
let _ = send_uni(&self.conn, msg).await;
}
}
@@ -92,7 +92,7 @@ pub trait ConAccepter: Send + Sync + 'static {
fn accept(
&self,
send: ClientSender,
) -> impl Future<Output = impl RecvHandler<ClientRequestMsg>> + Send;
) -> impl Future<Output = impl RecvHandler<ClientMsgInst>> + Send;
}
pub fn listen(