From 41253d84dcdb40354c83491ab89ab9f734bc5478 Mon Sep 17 00:00:00 2001
From: "p.nguyen"
Date: Thu, 31 Aug 2023 11:46:46 +0200
Subject: [PATCH] update for multiwriter error "short write"
---
stash.go | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/stash.go b/stash.go
index 59de2b5..773dbc8 100644
--- a/stash.go
+++ b/stash.go
@@ -165,7 +165,7 @@ func (s *Stash) Write(data []byte) (int, error) {
deadline := time.Now().Add(s.writeTimeout)
s.conn.SetWriteDeadline(deadline)
}
-
+ origPLen := len(data)
// remove any Carriage Return or Line Feed in bytes data
// before concate with new Carriage Return and Line Feed
data = bytes.Trim(data, string(CRLF))
@@ -187,7 +187,9 @@ func (s *Stash) Write(data []byte) (int, error) {
return 0, err
}
}
- return len(data), nil
+
+ return origPLen, nil
+ // return len(data), nil
}
// Close function, will close connection