Skip to content

Commit

Permalink
Move AddNATEntry() call to new entry only.
Browse files Browse the repository at this point in the history
  • Loading branch information
sbruens committed Jan 21, 2025
1 parent 9e54bd2 commit dd03e45
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion service/udp.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,10 @@ func PacketServe(clientConn net.PacketConn, assocHandle AssociationHandleFunc, m
return
}

metrics.AddNATEntry()
var existing bool
assoc, existing = nm.Add(addr.String(), assoc)
if !existing {
metrics.AddNATEntry()
go func() {
assocHandle(ctx, assoc)
metrics.RemoveNATEntry()
Expand Down

0 comments on commit dd03e45

Please sign in to comment.