mirror of
https://github.com/v2fly/v2ray-core.git
synced 2026-05-03 19:19:08 -04:00
fixes for sync logic
This commit is contained in:
@@ -87,6 +87,7 @@ func (this *DokodemoDoor) handleUDPPackets() {
|
||||
buffer := alloc.NewBuffer()
|
||||
this.udpMutex.RLock()
|
||||
if !this.accepting {
|
||||
this.udpMutex.RUnlock()
|
||||
return
|
||||
}
|
||||
nBytes, addr, err := this.udpConn.ReadFromUDP(buffer.Value)
|
||||
@@ -132,19 +133,17 @@ func (this *DokodemoDoor) ListenTCP(port v2net.Port) error {
|
||||
func (this *DokodemoDoor) AcceptTCPConnections() {
|
||||
for this.accepting {
|
||||
retry.Timed(100, 100).On(func() error {
|
||||
this.tcpMutex.RLock()
|
||||
defer this.tcpMutex.RUnlock()
|
||||
if !this.accepting {
|
||||
return nil
|
||||
}
|
||||
this.tcpMutex.RLock()
|
||||
defer this.tcpMutex.RUnlock()
|
||||
if this.tcpListener != nil {
|
||||
connection, err := this.tcpListener.AcceptTCP()
|
||||
if err != nil {
|
||||
log.Error("Dokodemo failed to accept new connections: %v", err)
|
||||
return err
|
||||
}
|
||||
go this.HandleTCPConnection(connection)
|
||||
connection, err := this.tcpListener.AcceptTCP()
|
||||
if err != nil {
|
||||
log.Error("Dokodemo failed to accept new connections: %v", err)
|
||||
return err
|
||||
}
|
||||
go this.HandleTCPConnection(connection)
|
||||
return nil
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user