Merge pull request #77 from chihaya/fixNPE
udp: fix nil ptr when socket fails to be created
This commit is contained in:
commit
fcc4a5472d
1 changed files with 1 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue