Fix shutdown deadlock for ws notification queue.
While here, correct the comment on rpcServer.notificationQueue. Closes #122.
This commit is contained in:
parent
42a494f762
commit
7b90b48bc6
1 changed files with 4 additions and 7 deletions
11
rpcserver.go
11
rpcserver.go
|
@ -1193,10 +1193,10 @@ func (s *rpcServer) drainNotifications() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// notifiationQueue manages a queue of empty interfaces, reading from in and
|
// notificationQueue manages an infinitly-growing queue of notifications that
|
||||||
// sending the oldest unsent to out. This handler stops when either of the
|
// wallet websocket clients may be interested in. It quits when the
|
||||||
// in or quit channels are closed, and closes out before returning, without
|
// enqueueNotifiation channel is closed, dropping any still pending
|
||||||
// waiting to send any variables still remaining in the queue.
|
// notifications.
|
||||||
func (s *rpcServer) notificationQueue() {
|
func (s *rpcServer) notificationQueue() {
|
||||||
var q []wsClientNotification
|
var q []wsClientNotification
|
||||||
var dequeue chan<- wsClientNotification
|
var dequeue chan<- wsClientNotification
|
||||||
|
@ -1232,9 +1232,6 @@ out:
|
||||||
} else {
|
} else {
|
||||||
next = q[0]
|
next = q[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
case <-s.quit:
|
|
||||||
break out
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
close(s.dequeueNotification)
|
close(s.dequeueNotification)
|
||||||
|
|
Loading…
Reference in a new issue