From 7b90b48bc6bad2428db826685977582bd6b043b0 Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Wed, 13 Aug 2014 09:03:36 -0500 Subject: [PATCH] Fix shutdown deadlock for ws notification queue. While here, correct the comment on rpcServer.notificationQueue. Closes #122. --- rpcserver.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/rpcserver.go b/rpcserver.go index 5db8612..3509bb6 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -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)