server side preparation
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user