Fix shutdown deadlock for ws notification queue.

While here, correct the comment on rpcServer.notificationQueue.

Closes #122.
This commit is contained in:
Josh Rickmar 2014-08-13 09:03:36 -05:00
parent 42a494f762
commit 7b90b48bc6

View file

@ -1193,10 +1193,10 @@ func (s *rpcServer) drainNotifications() {
}
}
// notifiationQueue manages a queue of empty interfaces, reading from in and
// sending the oldest unsent to out. This handler stops when either of the
// in or quit channels are closed, and closes out before returning, without
// waiting to send any variables still remaining in the queue.
// notificationQueue manages an infinitly-growing queue of notifications that
// wallet websocket clients may be interested in. It quits when the
// enqueueNotifiation channel is closed, dropping any still pending
// notifications.
func (s *rpcServer) notificationQueue() {
var q []wsClientNotification
var dequeue chan<- wsClientNotification
@ -1232,9 +1232,6 @@ out:
} else {
next = q[0]
}
case <-s.quit:
break out
}
}
close(s.dequeueNotification)