only use nc if end packet message is empty

This commit is contained in:
soruh 2023-03-19 14:26:30 +01:00
parent c9d30bb299
commit 4a191a5652

View File

@ -183,8 +183,10 @@ pub async fn connection_handler(
if packet.kind() == PacketKind::End {
packet.header.kind = PacketKind::Reject.raw();
packet.data.clear();
packet.data.extend_from_slice(b"nc\0");
packet.header.length = packet.data.len() as u8;
if packet.data.is_empty() {
packet.data.extend_from_slice(b"nc\0");
packet.header.length = packet.data.len() as u8;
}
}
port_handler.lock().await.start_rejector(