Skip to content

Commit

Permalink
use straight forward nil handling
Browse files Browse the repository at this point in the history
  • Loading branch information
xtaci committed Dec 16, 2024
1 parent 51330a2 commit 54840c5
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions hopper.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,11 @@ func (l *Listener) clientIn(data []byte, raddr net.Addr) {
// onClientIn callback
if l.onClientIn != nil {
data = l.onClientIn(raddr, data)
// blackhole the packet if the callback returns nil
if data == nil {
return
}
}

// blackhole if the data is nil after onClientIn callback
if data == nil {
return
}

// encrypt or re-encrypt the packet if crypterOut is set(with new nonce)
Expand Down

0 comments on commit 54840c5

Please sign in to comment.