mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-11-04 09:17:32 -05:00
prevent double close in tcp hub
This commit is contained in:
parent
e480091388
commit
52ed93408b
@ -63,11 +63,16 @@ func ListenTCP(address v2net.Address, port v2net.Port, callback ConnectionHandle
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (v *TCPHub) Close() {
|
func (v *TCPHub) Close() {
|
||||||
|
defer func() {
|
||||||
|
recover()
|
||||||
|
}()
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-v.closed:
|
case <-v.closed:
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
v.listener.Close()
|
v.listener.Close()
|
||||||
|
close(v.closed)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user