fix a deadlock

pull/1132/merge
Darien Raymond 2018-05-31 13:12:36 +02:00
parent 4a46817cf6
commit ee0ca6cbd2
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
1 changed files with 2 additions and 1 deletions

View File

@ -328,6 +328,8 @@ func (w *udpWorker) Start() error {
Execute: func() error {
nowSec := time.Now().Unix()
w.Lock()
defer w.Unlock()
if len(w.activeConn) == 0 {
return nil
}
@ -342,7 +344,6 @@ func (w *udpWorker) Start() error {
if len(w.activeConn) == 0 {
w.activeConn = make(map[connID]*udpConn, 16)
}
w.Unlock()
return nil
},