Skip to content

Commit e5c0eec

Browse files
committed
feat(proxy): improve packet handling diagnostics
- Add channel capacity status to player packet send errors - Add timing metrics for packet flush operations with warnings for operations >50ms
1 parent 937fbc2 commit e5c0eec

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

crates/hyperion-proxy/src/data.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,9 @@ impl PlayerHandle {
138138
Ok(true) => Ok(()),
139139

140140
Ok(false) => {
141+
let is_full = self.writer.is_full();
141142
self.shutdown();
142-
bail!("failed to send packet to player, channel is full");
143+
bail!("failed to send packet to player, channel is full: {is_full}");
143144
}
144145
Err(e) => {
145146
self.writer.close();

crates/hyperion-proxy/src/player.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,17 @@ pub fn initiate_player_connection(
124124
if outgoing_packet.is_shutdown() {
125125
return;
126126
}
127-
127+
128128
if outgoing_packet.is_flush() {
129+
let time_start = std::time::Instant::now();
129130
if let Err(e) = packet_writer.flush_pending_packets().await {
130131
warn!("Error flushing packets to player: {e:?}");
131132
return;
132133
}
134+
let duration = time_start.elapsed();
135+
if duration > std::time::Duration::from_millis(50) {
136+
warn!("flushed packets to player in {duration:?}");
137+
}
133138
} else {
134139
packet_writer.enqueue_packet(outgoing_packet);
135140
}

0 commit comments

Comments
 (0)