refactor(client): capture send timestamp before socket call

Record the send timestamp immediately before the socket operation to include local enqueue overhead in RTT measurements, providing more conservative latency data for consumers.
This commit is contained in:
Nils Andreas Svee committed 2026-05-10 20:56:43 +07:00
1 parent 1cc0d60eac
commit b9fc4b9cee
1 file changed
+1 -2
+1 -2
View File
@@ -201,9 +201,8 @@ impl Client {
payload: vec![], payload: vec![],
}; };
let packet = encode_echo_request(&request, self.config.hmac_key.as_deref())?; let packet = encode_echo_request(&request, self.config.hmac_key.as_deref())?;
self.socket.send(&packet)?;
let sent_at = override_ts.unwrap_or_else(ClientTimestamp::now); let sent_at = override_ts.unwrap_or_else(ClientTimestamp::now);
self.socket.send(&packet)?;
let session = self let session = self
.session .session