Remove empty map on address unsubscribe
This commit is contained in:
parent
4338d10dcb
commit
c2e32b0a25
@ -684,10 +684,13 @@ func (s *WebsocketServer) subscribeAddresses(c *websocketChannel, addrDesc []bch
|
|||||||
func (s *WebsocketServer) unsubscribeAddresses(c *websocketChannel) (res interface{}, err error) {
|
func (s *WebsocketServer) unsubscribeAddresses(c *websocketChannel) (res interface{}, err error) {
|
||||||
s.addressSubscriptionsLock.Lock()
|
s.addressSubscriptionsLock.Lock()
|
||||||
defer s.addressSubscriptionsLock.Unlock()
|
defer s.addressSubscriptionsLock.Unlock()
|
||||||
for _, sa := range s.addressSubscriptions {
|
for ads, sa := range s.addressSubscriptions {
|
||||||
for sc := range sa {
|
for sc := range sa {
|
||||||
if sc == c {
|
if sc == c {
|
||||||
delete(sa, c)
|
delete(sa, c)
|
||||||
|
if len(sa) == 0 {
|
||||||
|
delete(s.addressSubscriptions, ads)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user