Merge pull request #77 from chihaya/fixNPE

udp: fix nil ptr when socket fails to be created
This commit is contained in:
Justin Li 2015-07-08 20:29:14 -04:00
commit fcc4a5472d

View file

@ -41,11 +41,11 @@ func (s *Server) serve(listenAddr string) error {
}
sock, err := net.ListenUDP("udp", udpAddr)
defer sock.Close()
if err != nil {
close(s.booting)
return err
}
defer sock.Close()
if s.config.UDPReadBufferSize > 0 {
sock.SetReadBuffer(s.config.UDPReadBufferSize)