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.
This commit is contained in:
parent
7d35bc9460
commit
7162a11995
1 changed files with 8 additions and 1 deletions
|
@ -341,6 +341,10 @@ func (m *wsNotificationManager) AddSpentRequest(wsc *wsClient, op *btcwire.OutPo
|
||||||
//
|
//
|
||||||
// This function MUST be called with the notification manager lock held.
|
// This function MUST be called with the notification manager lock held.
|
||||||
func (m *wsNotificationManager) removeSpentRequest(wsc *wsClient, op *btcwire.OutPoint) {
|
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]
|
notifyMap, ok := m.spentNotifications[*op]
|
||||||
if !ok {
|
if !ok {
|
||||||
rpcsLog.Warnf("Attempt to remove nonexistent spent request "+
|
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.
|
// This function MUST be called with the notification manager lock held.
|
||||||
func (m *wsNotificationManager) removeAddrRequest(wsc *wsClient, addr string) {
|
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]
|
notifyMap, ok := m.addrNotifications[addr]
|
||||||
if !ok {
|
if !ok {
|
||||||
rpcsLog.Warnf("Attempt to remove nonexistent addr request "+
|
rpcsLog.Warnf("Attempt to remove nonexistent addr request "+
|
||||||
"<%s> for websocket client %s", addr, wsc.addr)
|
"<%s> for websocket client %s", addr, wsc.addr)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
delete(notifyMap, wsc.quit)
|
delete(notifyMap, wsc.quit)
|
||||||
|
|
||||||
// Remove the map entry altogether if there are no more clients
|
// Remove the map entry altogether if there are no more clients
|
||||||
|
|
Loading…
Reference in a new issue