Working on more hp

This commit is contained in:
Owen
2025-12-03 20:49:46 -05:00
parent 284f1ce627
commit 8c4d6e2e0a
10 changed files with 157 additions and 142 deletions

View File

@@ -140,16 +140,19 @@ func (t *HolepunchTester) Stop() {
// handleResponse is called by SharedBind when a magic response is received
func (t *HolepunchTester) handleResponse(addr netip.AddrPort, echoData []byte) {
logger.Debug("Received magic response from %s", addr.String())
key := string(echoData)
value, ok := t.pendingRequests.LoadAndDelete(key)
if !ok {
// No matching request found
logger.Debug("No pending request found for magic response from %s", addr.String())
return
}
req := value.(*pendingRequest)
rtt := time.Since(req.sentAt)
logger.Debug("Magic response matched pending request for %s (RTT: %v)", req.endpoint, rtt)
// Send RTT to the waiting goroutine (non-blocking)
select {