Skip to content

Commit

Permalink
udp: add rtt summary
Browse files Browse the repository at this point in the history
  • Loading branch information
ignoramous committed Feb 1, 2025
1 parent 0786d93 commit 86b3ff4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions intra/udp.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,8 @@ func (h *udpHandler) Connect(gconn *netstack.GUDPConn, src, target netip.AddrPor
}
// note: fake-dns-ips shouldn't be un-nated / un-alg'd
for i, dstipp := range actualTargets {
rttstart := time.Now()

if px, err = h.prox.ProxyTo(dstipp, uid, pids); err != nil || px == nil {
log.W("udp: connect: %s failed to get proxy from %s: %v", cid, pids, err)
errs = err // disconnect if loop terminates
Expand All @@ -296,6 +298,8 @@ func (h *udpHandler) Connect(gconn *netstack.GUDPConn, src, target netip.AddrPor

errs = err // store just the last err; complicates logging
end := time.Since(smm.start)
rtt := time.Since(rttstart)
smm.Rtt = int32(rtt.Seconds() * 1000)
log.W("udp: connect: #%d: %s failed; mux? %t, addr(%s); for uid %s (%dms) w err(%v)",
i, cid, mux, dstipp, uid, end.Milliseconds(), err)
if end > retrytimeout {
Expand Down

0 comments on commit 86b3ff4

Please sign in to comment.