Fix HandshakeFailure usages

This commit is contained in:
世界 2024-11-14 22:04:31 +08:00
parent b4300eaa6a
commit b8b3759826
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
4 changed files with 11 additions and 10 deletions

View file

@ -102,13 +102,13 @@ func (w *UDPBackWriter) HandshakeSuccess() error {
func (w *UDPBackWriter) HandshakeFailure(err error) error {
w.access.Lock()
defer w.access.Unlock()
if w.packet != nil {
wErr := gWriteUnreachable(w.stack, w.packet)
w.packet.DecRef()
w.packet = nil
return wErr
if w.packet == nil {
return os.ErrInvalid
}
return nil
wErr := gWriteUnreachable(w.stack, w.packet)
w.packet.DecRef()
w.packet = nil
return wErr
}
func (w *UDPBackWriter) WritePacket(packetBuffer *buf.Buffer, destination M.Socksaddr) error {