handle ctrlc
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user