fixes for mutex usage

This commit is contained in:
v2ray
2016-01-04 08:40:24 +01:00
parent 59a5f832f6
commit 4271e619fe
4 changed files with 10 additions and 0 deletions

View File

@@ -77,7 +77,9 @@ func (this *DokodemoDoor) ListenUDP(port v2net.Port) error {
log.Error("Dokodemo failed to listen on port %d: %v", port, err)
return err
}
this.udpMutex.Lock()
this.udpConn = udpConn
this.udpMutex.Unlock()
go this.handleUDPPackets()
return nil
}
@@ -125,7 +127,9 @@ func (this *DokodemoDoor) ListenTCP(port v2net.Port) error {
log.Error("Dokodemo failed to listen on port %d: %v", port, err)
return err
}
this.tcpMutex.Lock()
this.tcpListener = tcpListener
this.tcpMutex.Unlock()
go this.AcceptTCPConnections()
return nil
}