Skip to content

Commit

Permalink
Close the UDPConn before returning if setUDPSocketOptions went wrong (
Browse files Browse the repository at this point in the history
#1227)

Detail: #1226
  • Loading branch information
nirui authored Feb 25, 2021
1 parent c08efdc commit 2543d8b
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,7 @@ func (srv *Server) ListenAndServe() error {
}
u := l.(*net.UDPConn)
if e := setUDPSocketOptions(u); e != nil {
u.Close()
return e
}
srv.PacketConn = l
Expand Down

0 comments on commit 2543d8b

Please sign in to comment.