Skip to content

Commit

Permalink
Log too many open file error.
Browse files Browse the repository at this point in the history
  • Loading branch information
cyfdecyf committed Dec 21, 2012
1 parent 1a6db46 commit d6dc84f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/shadowsocks-server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,13 @@ func handleConnection(conn *ss.Conn) {
debug.Println("connecting", host)
remote, err := net.Dial("tcp", host)
if err != nil {
debug.Println("error connecting to:", host, err)
if ne, ok := err.(*net.OpError); ok && (ne.Err == syscall.EMFILE || ne.Err == syscall.ENFILE) {
// log too many open file error
// EMFILE is process reaches open file limits, ENFILE is system limit
log.Println("dial error:", err)
} else {
debug.Println("error connecting to:", host, err)
}
return
}
defer remote.Close()
Expand Down

0 comments on commit d6dc84f

Please sign in to comment.