only use nc in reject packets if no other message was supplied

This commit is contained in:
soruh 2023-03-19 14:45:25 +01:00
parent baf84555bd
commit 93cb25cd54
2 changed files with 5 additions and 8 deletions

View File

@ -180,13 +180,11 @@ pub async fn connection_handler(
if matches!(packet.kind(), PacketKind::End | PacketKind::Reject) { if matches!(packet.kind(), PacketKind::End | PacketKind::Reject) {
info!(?packet, "got disconnect packet"); info!(?packet, "got disconnect packet");
if packet.kind() == PacketKind::End { packet.header.kind = PacketKind::Reject.raw();
packet.header.kind = PacketKind::Reject.raw();
packet.data.clear(); if packet.data.is_empty() {
if packet.data.is_empty() { packet.data.extend_from_slice(b"nc\0");
packet.data.extend_from_slice(b"nc\0"); packet.header.length = packet.data.len() as u8;
packet.header.length = packet.data.len() as u8;
}
} }
port_handler.lock().await.start_rejector( port_handler.lock().await.start_rejector(

View File

@ -172,7 +172,6 @@ fn main() -> anyhow::Result<()> {
.with( .with(
fmt::layer() fmt::layer()
.with_target(true) .with_target(true)
.with_ansi(true)
.with_timer(fmt::time::OffsetTime::new( .with_timer(fmt::time::OffsetTime::new(
*TIME_ZONE_OFFSET.get().unwrap(), *TIME_ZONE_OFFSET.get().unwrap(),
TIME_FORMAT.get().unwrap(), TIME_FORMAT.get().unwrap(),