Skip to content

Commit

Permalink
fixed 20200501 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
txthinking committed May 1, 2020
1 parent 763843a commit fe8e9a8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,15 +335,19 @@ func (s *Server) UDPHandle(addr *net.UDPAddr, b []byte) error {
}
if err := send(ue, data); err != nil {
ue.RemoteConn.Close()
ue.Internet.Close()
if ue.Internet != nil {
ue.Internet.Close()
}
return err
}
s.Cache.Set(ue.ClientAddr.String(), ue, cache.DefaultExpiration)
go func(ue *ServerUDPExchange) {
defer func() {
s.Cache.Delete(ue.ClientAddr.String())
ue.RemoteConn.Close()
ue.Internet.Close()
if ue.Internet != nil {
ue.Internet.Close()
}
}()
var b [65535]byte
for {
Expand Down

0 comments on commit fe8e9a8

Please sign in to comment.