From da993eb034450af542c4c3606fb17ced18b87f6b Mon Sep 17 00:00:00 2001 From: Josh Rickmar Date: Fri, 25 Jul 2014 08:20:58 -0500 Subject: [PATCH] Fix sending of next item in notification queue. The notification queue used for websocket client notifications had a bug which caused the next queued item in some situations to not be sent, but instead send a previously sent item. This change fixes this by setting the 'next' variable to the next item which must be dequeued, if the queue length is non-zero. This bug did not always manifest itself as if the receiving goroutine was ready, a queued item could be sent directly to it rather than waiting in the queue to be sent at a later time. --- rpcwebsocket.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rpcwebsocket.go b/rpcwebsocket.go index b8349224..c24da299 100644 --- a/rpcwebsocket.go +++ b/rpcwebsocket.go @@ -160,6 +160,8 @@ out: if len(q) == 0 { dequeue = nil skipQueue = out + } else { + next = q[0] } case <-quit: