Browse Source

prevent double close in tcp hub

pull/432/head
Darien Raymond 8 years ago
parent
commit
52ed93408b
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
  1. 5
      transport/internet/tcp_hub.go

5
transport/internet/tcp_hub.go

@ -63,11 +63,16 @@ func ListenTCP(address v2net.Address, port v2net.Port, callback ConnectionHandle
}
func (v *TCPHub) Close() {
defer func() {
recover()
}()
select {
case <-v.closed:
return
default:
v.listener.Close()
close(v.closed)
}
}

Loading…
Cancel
Save