Merge pull request #401 from github/sock-nil-connection

error and nil checks on socket connection
This commit is contained in:
Shlomi Noach 2017-04-18 06:42:48 +03:00 committed by GitHub
commit de349a79c6

View File

@ -98,8 +98,13 @@ func (this *Server) Serve() (err error) {
}
func (this *Server) handleConnection(conn net.Conn) (err error) {
defer conn.Close()
if conn != nil {
defer conn.Close()
}
command, _, err := bufio.NewReader(conn).ReadLine()
if err != nil {
return err
}
return this.onServerCommand(string(command), bufio.NewWriter(conn))
}