From 7162a11995c53f7bed7cd95df1d0ec8eb78a2da6 Mon Sep 17 00:00:00 2001 From: Dave Collins Date: Wed, 19 Feb 2014 09:13:49 -0600 Subject: [PATCH] Remove tracking requests from websocket client too. When a spent notification and address notification is removed, the tracking entry in the client which is used to track what to remove on shutdown needs to be removed as well. --- rpcwebsocket.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/rpcwebsocket.go b/rpcwebsocket.go index 7c01c6ab2..e03c53ab8 100644 --- a/rpcwebsocket.go +++ b/rpcwebsocket.go @@ -341,6 +341,10 @@ func (m *wsNotificationManager) AddSpentRequest(wsc *wsClient, op *btcwire.OutPo // // This function MUST be called with the notification manager lock held. func (m *wsNotificationManager) removeSpentRequest(wsc *wsClient, op *btcwire.OutPoint) { + // Remove the request tracking from the client. + delete(wsc.spentRequests, *op) + + // Remove the client from the list to notify. notifyMap, ok := m.spentNotifications[*op] if !ok { rpcsLog.Warnf("Attempt to remove nonexistent spent request "+ @@ -533,13 +537,16 @@ func (m *wsNotificationManager) AddAddrRequest(wsc *wsClient, addr string) { // // This function MUST be called with the notification manager lock held. func (m *wsNotificationManager) removeAddrRequest(wsc *wsClient, addr string) { + // Remove the request tracking from the client. + delete(wsc.addrRequests, addr) + + // Remove the client from the list to notify. notifyMap, ok := m.addrNotifications[addr] if !ok { rpcsLog.Warnf("Attempt to remove nonexistent addr request "+ "<%s> for websocket client %s", addr, wsc.addr) return } - delete(notifyMap, wsc.quit) // Remove the map entry altogether if there are no more clients