Skip to content

Commit

Permalink
Set read request timeout in server.go
Browse files Browse the repository at this point in the history
  • Loading branch information
cyfdecyf committed Dec 14, 2012
1 parent d5ebbcc commit f36c080
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cmd/shadowsocks-server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
}

0 comments on commit f36c080

Please sign in to comment.