udp: fix nil ptr when socket fails to be created
This commit is contained in:
parent
e27fbe9652
commit
6b53ceb2a3
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)
|
sock, err := net.ListenUDP("udp", udpAddr)
|
||||||
defer sock.Close()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
close(s.booting)
|
close(s.booting)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer sock.Close()
|
||||||
|
|
||||||
if s.config.UDPReadBufferSize > 0 {
|
if s.config.UDPReadBufferSize > 0 {
|
||||||
sock.SetReadBuffer(s.config.UDPReadBufferSize)
|
sock.SetReadBuffer(s.config.UDPReadBufferSize)
|
||||||
|
|
Loading…
Reference in a new issue