Liu Song’s Projects


~/Projects/shadowsocks-go

git clone https://code.lsong.org/shadowsocks-go

Commit

Commit
c7fd071f2223634d351d0ed3b0520af162457db1
Author
eric <[email protected]>
Date
2019-07-06 14:32:30 +0800 +0800
Diffstat
 tcp.go | 2 +-

fix UDP associate

Read() simply returns if the buffer is empty.


diff --git a/tcp.go b/tcp.go
index fe0701d52ead1250add8f8067344aa15a9239758..243b2704772dec0fb548295968e411aed860cc55 100644
--- a/tcp.go
+++ b/tcp.go
@@ -48,7 +48,7 @@ 			if err != nil {
 
 				// UDP: keep the connection until disconnect then free the UDP socket
 				if err == socks.InfoUDPAssociate {
-					buf := []byte{}
+					buf := make([]byte, 1)
 					// block here
 					for {
 						_, err := c.Read(buf)