mirror of
https://github.com/strukturag/nextcloud-spreed-signaling
synced 2024-06-06 16:02:22 +02:00
Use new builtin "clear" to remove map entries.
This commit is contained in:
parent
d03ea86991
commit
fdc43d12cd
|
@ -280,6 +280,8 @@ func (e *asyncEventsNats) Close() {
|
|||
sub.close()
|
||||
}
|
||||
}(e.sessionSubscriptions)
|
||||
// Can't use clear(...) here as the maps are processed asynchronously by the
|
||||
// goroutines above.
|
||||
e.backendRoomSubscriptions = make(map[string]*asyncBackendRoomSubscriberNats)
|
||||
e.roomSubscriptions = make(map[string]*asyncRoomSubscriberNats)
|
||||
e.userSubscriptions = make(map[string]*asyncUserSubscriberNats)
|
||||
|
|
|
@ -310,7 +310,7 @@ func (gateway *JanusGateway) cancelTransactions() {
|
|||
t.quit()
|
||||
}(t)
|
||||
}
|
||||
gateway.transactions = make(map[uint64]*transaction)
|
||||
clear(gateway.transactions)
|
||||
gateway.Unlock()
|
||||
}
|
||||
|
||||
|
|
|
@ -250,7 +250,7 @@ func (m *mcuJanus) doReconnect() {
|
|||
|
||||
log.Println("Reconnection to Janus gateway successful")
|
||||
m.mu.Lock()
|
||||
m.publishers = make(map[string]*mcuJanusPublisher)
|
||||
clear(m.publishers)
|
||||
m.publisherCreated.Reset()
|
||||
m.publisherConnected.Reset()
|
||||
m.reconnectInterval = initialReconnectInterval
|
||||
|
|
|
@ -746,8 +746,9 @@ func (c *mcuProxyConnection) clearPublishers() {
|
|||
publisher.NotifyClosed()
|
||||
}
|
||||
}(c.publishers)
|
||||
// Can't use clear(...) here as the map is processed by the goroutine above.
|
||||
c.publishers = make(map[string]*mcuProxyPublisher)
|
||||
c.publisherIds = make(map[string]string)
|
||||
clear(c.publisherIds)
|
||||
|
||||
if c.closeScheduled.Load() || c.IsTemporary() {
|
||||
go c.closeIfEmpty()
|
||||
|
@ -777,6 +778,7 @@ func (c *mcuProxyConnection) clearSubscribers() {
|
|||
subscriber.NotifyClosed()
|
||||
}
|
||||
}(c.subscribers)
|
||||
// Can't use clear(...) here as the map is processed by the goroutine above.
|
||||
c.subscribers = make(map[string]*mcuProxySubscriber)
|
||||
|
||||
if c.closeScheduled.Load() || c.IsTemporary() {
|
||||
|
@ -788,7 +790,7 @@ func (c *mcuProxyConnection) clearCallbacks() {
|
|||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
|
||||
c.callbacks = make(map[string]func(*ProxyServerMessage))
|
||||
clear(c.callbacks)
|
||||
}
|
||||
|
||||
func (c *mcuProxyConnection) getCallback(id string) func(*ProxyServerMessage) {
|
||||
|
|
|
@ -299,8 +299,9 @@ func (s *ProxySession) clearPublishers() {
|
|||
publisher.Close(context.Background())
|
||||
}
|
||||
}(s.publishers)
|
||||
// Can't use clear(...) here as the map is processed by the goroutine above.
|
||||
s.publishers = make(map[string]signaling.McuPublisher)
|
||||
s.publisherIds = make(map[signaling.McuPublisher]string)
|
||||
clear(s.publisherIds)
|
||||
}
|
||||
|
||||
func (s *ProxySession) clearSubscribers() {
|
||||
|
@ -315,8 +316,9 @@ func (s *ProxySession) clearSubscribers() {
|
|||
subscriber.Close(context.Background())
|
||||
}
|
||||
}(s.subscribers)
|
||||
// Can't use clear(...) here as the map is processed by the goroutine above.
|
||||
s.subscribers = make(map[string]signaling.McuSubscriber)
|
||||
s.subscriberIds = make(map[signaling.McuSubscriber]string)
|
||||
clear(s.subscriberIds)
|
||||
}
|
||||
|
||||
func (s *ProxySession) NotifyDisconnected() {
|
||||
|
|
Loading…
Reference in a new issue