Selaa lähdekoodia

Fix: don't skip fragmentor notice in early exit success case

Rod Hynes 6 vuotta sitten
vanhempi
sitoutus
bf809b97a3
1 muutettua tiedostoa jossa 5 lisäystä ja 1 poistoa
  1. 5 1
      psiphon/common/fragmentor/fragmentor.go

+ 5 - 1
psiphon/common/fragmentor/fragmentor.go

@@ -337,7 +337,11 @@ func (c *Conn) Write(buffer []byte) (int, error) {
 		if c.bytesFragmented >= c.bytesToFragment {
 			bytesWritten, err := c.Conn.Write(buffer)
 			totalBytesWritten += bytesWritten
-			return totalBytesWritten, err
+			if err != nil {
+				return totalBytesWritten, err
+			} else {
+				buffer = nil
+			}
 		}
 	}