handle ctrlc

This commit is contained in:
2025-11-28 20:24:26 -05:00
parent 7557507f27
commit 4aa22de61b
3 changed files with 36 additions and 22 deletions

View File

@@ -43,13 +43,6 @@ impl NetState {
}
}
pub fn connection(&self) -> Option<&NetHandle> {
match self {
NetState::Connected(net_handle) => Some(net_handle),
_ => None,
}
}
pub fn take(&mut self) -> Self {
std::mem::replace(self, Self::None)
}
@@ -65,7 +58,6 @@ pub fn connect(handle: AppHandle, info: ConnectInfo) -> JoinHandle<()> {
type NetResult<T> = Result<T, String>;
type MsgPayload = ClientMsg;
#[derive(Clone)]
pub struct NetSender {
send: UnboundedSender<NetCtrlMsg>,
@@ -175,7 +167,7 @@ async fn connect_the(handle: AppHandle, info: ConnectInfo) -> NetResult<()> {
}
}
NetCtrlMsg::Exit => {
conn.close(quinn::VarInt::from_u32(0), &[]);
conn.close(0u32.into(), &[]);
endpoint.wait_idle().await;
break;
}