From f36c08072914cc834a8a872093d01b6eeb8bfd81 Mon Sep 17 00:00:00 2001 From: Chen Yufei Date: Fri, 14 Dec 2012 10:43:26 +0800 Subject: [PATCH] Set read request timeout in server.go --- cmd/shadowsocks-server/server.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/shadowsocks-server/server.go b/cmd/shadowsocks-server/server.go index d06f96a..9c19657 100644 --- a/cmd/shadowsocks-server/server.go +++ b/cmd/shadowsocks-server/server.go @@ -28,6 +28,7 @@ func getRequest(conn *ss.Conn) (host string, extra []byte, err error) { for { // hopefully, we should only need one read to get the complete request // this read normally will read just the request, no extra data + ss.SetReadTimeout(conn) if n, err = conn.Read(buf[cur:]); err != nil { // debug.Println("read request error:", err) return @@ -170,6 +171,6 @@ func main() { log.Println("all ports ready") tableCache = nil // release memory c := make(chan byte) - <-c // block forever + <-c // block forever } }