basic web view

This commit is contained in:
2023-06-11 06:30:31 +02:00
parent e609cb0f44
commit 2aedf86736
4 changed files with 119 additions and 19 deletions

View File

@@ -21,7 +21,7 @@ use tracing::{debug, error, info, instrument, warn};
use crate::{
constants::{CACHE_STORE_INTERVAL, PORT_OWNERSHIP_TIMEOUT, PORT_RETRY_TIME},
packets::{Packet, PacketKind},
packets::Packet,
spawn, Config, Number, Port, UnixTimestamp,
};
@@ -302,17 +302,10 @@ impl Serialize for Rejector {
S: Serializer,
{
let packet = &self.state.1;
let kind = match packet.kind() {
PacketKind::End => "end",
PacketKind::Reject => "reject",
_ => unreachable!(),
};
match packet.as_string() {
Some(string) if string.chars().all(|c| !c.is_control()) => {
(kind, string).serialize(serializer)
}
_ => (kind, packet.data()).serialize(serializer),
Some(string) if string.chars().all(|c| !c.is_control()) => string.serialize(serializer),
_ => packet.data().serialize(serializer),
}
}
}