Skip to content

Commit

Permalink
Fixed panic when removing UDP server (with access control enabled) #215
Browse files Browse the repository at this point in the history
  • Loading branch information
illarion committed Apr 16, 2019
1 parent fdbe2c4 commit d413a49
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions server/udp/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,13 +190,6 @@ func (this *Server) serve() {
for {
n, clientAddr, err := this.serverConn.ReadFromUDP(buf)

if this.access != nil {
if !this.access.Allows(&clientAddr.IP) {
log.Debug("Client disallowed to connect: ", clientAddr.IP)
continue
}
}

if err != nil {
if atomic.LoadUint32(&this.stopped) == 1 {
return
Expand All @@ -207,6 +200,13 @@ func (this *Server) serve() {
continue
}

if this.access != nil {
if !this.access.Allows(&clientAddr.IP) {
log.Debug("Client disallowed to connect: ", clientAddr.IP)
continue
}
}

//special case for single request mode
if cfg.MaxRequests == 1 {
err := this.fireAndForget(clientAddr, buf[:n])
Expand Down

0 comments on commit d413a49

Please sign in to comment.