From 85eac315d84b117512c81928b12250a12db48abe Mon Sep 17 00:00:00 2001 From: cnderrauber Date: Tue, 10 Dec 2024 10:48:01 +0800 Subject: [PATCH] Return 0 written bytes on write error Return 0 written bytes on write error --- stream.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/stream.go b/stream.go index ed06d69a..5f342793 100644 --- a/stream.go +++ b/stream.go @@ -295,6 +295,9 @@ func (s *Stream) WriteSCTP(p []byte, ppi PayloadProtocolIdentifier) (int, error) if s.association.isBlockWrite() { s.writeLock.Unlock() } + if err != nil { + n = 0 + } return n, err }