Disconnect stopped client handlers

This commit is contained in:
Jon Häggblad
2024-02-08 16:03:34 +01:00
parent d4ca2a7220
commit d8e484b77e
2 changed files with 97 additions and 31 deletions
+42
View File
@@ -64,6 +64,48 @@ impl IpPacketResponse {
}
}
pub fn new_disconnect_success(request_id: u64, reply_to: Recipient) -> Self {
Self {
version: CURRENT_VERSION,
data: IpPacketResponseData::Disconnect(DisconnectResponse {
request_id,
reply_to,
reply: DisconnectResponseReply::Success,
}),
}
}
pub fn new_disconnect_failure(
request_id: u64,
reply_to: Recipient,
reason: DisconnectFailureReason,
) -> Self {
Self {
version: CURRENT_VERSION,
data: IpPacketResponseData::Disconnect(DisconnectResponse {
request_id,
reply_to,
reply: DisconnectResponseReply::Failure(reason),
}),
}
}
// TODO
// pub fn new_unrequested_disconnect(
// request_id: u64,
// reply_to: Recipient,
// reason: UnrequestedDisconnectReason,
// ) -> Self {
// Self {
// version: CURRENT_VERSION,
// data: IpPacketResponseData::Disconnect(DisconnectResponse {
// request_id: 0,
// reply_to: Recipient::new(),
// reply: DisconnectResponseReply::Failure(DisconnectFailureReason::Unrequested),
// }),
// }
// }
pub fn new_ip_packet(ip_packet: bytes::Bytes) -> Self {
Self {
version: CURRENT_VERSION,