Skip to content

Commit

Permalink
cleanup when unexpected packet received
Browse files Browse the repository at this point in the history
  • Loading branch information
waldner committed Oct 22, 2024
1 parent e69c06d commit 4234ee6
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions single_port.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,13 @@ func (s *Server) singlePortProcessRequests() error {
s.Unlock()
go func() {
err := s.handlePacket(localAddr, srcAddr, buf, cnt, maxSz, lc)
if err != nil && s.hook != nil {
s.hook.OnFailure(TransferStats{
SenderAnticipateEnabled: s.sendAEnable,
}, err)
if err != nil {
if s.hook != nil {
s.hook.OnFailure(TransferStats{
SenderAnticipateEnabled: s.sendAEnable,
}, err)
}
delete(s.handlers, srcAddr.String())
}
}()
}
Expand Down

0 comments on commit 4234ee6

Please sign in to comment.