Merge pull request #401 from github/sock-nil-connection
error and nil checks on socket connection
This commit is contained in:
commit
de349a79c6
@ -98,8 +98,13 @@ func (this *Server) Serve() (err error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *Server) handleConnection(conn net.Conn) (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()
|
command, _, err := bufio.NewReader(conn).ReadLine()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
return this.onServerCommand(string(command), bufio.NewWriter(conn))
|
return this.onServerCommand(string(command), bufio.NewWriter(conn))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user