1
0

Fix: return pooled buffer when simple-obfs tls read error (#2643)

This commit is contained in:
包布丁 2023-03-26 16:22:23 +08:00 committed by GitHub
parent 8f9b39c62e
commit 7e2974f02f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,10 +27,10 @@ type TLSObfs struct {
func (to *TLSObfs) read(b []byte, discardN int) (int, error) {
buf := pool.Get(discardN)
_, err := io.ReadFull(to.Conn, buf)
pool.Put(buf)
if err != nil {
return 0, err
}
pool.Put(buf)
sizeBuf := make([]byte, 2)
_, err = io.ReadFull(to.Conn, sizeBuf)