From 54840c554272b85cfdf484748f4bfa9987d9cfba Mon Sep 17 00:00:00 2001 From: xtaci Date: Mon, 16 Dec 2024 20:06:37 +0800 Subject: [PATCH] use straight forward nil handling --- hopper.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/hopper.go b/hopper.go index adb0831..8aa0fdd 100644 --- a/hopper.go +++ b/hopper.go @@ -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)