1
0
mirror of https://github.com/v2fly/v2ray-core.git synced 2024-06-25 17:05:23 +00:00

prevent double close in tcp hub

This commit is contained in:
Darien Raymond 2017-02-21 23:18:25 +01:00
parent e480091388
commit 52ed93408b
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

View File

@ -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)
}
}