You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Subscribe subscribes to this topicfunc (t*topic) Subscribe(ssubscriber, userIDstring, cancelfunc()) int {
t.mu.Lock()
defert.mu.Unlock()
subscriberID:=rand.Int() // <---- heret.subscribers[subscriberID] =&topicSubscriber{
userID: userID, // May be emptysubscriber: s,
cancel: cancel,
}
t.lastAccess=time.Now()
returnsubscriberID
}
Nothing prevents subscriberID := rand.Int() from producing an integer which is already present in the t.subscribers map. In that case, the previous subscriber is over-written.
The text was updated successfully, but these errors were encountered:
ntfy/server/topic.go
Line 50 in 6ad3b2e
Nothing prevents
subscriberID := rand.Int()
from producing an integer which is already present in thet.subscribers
map. In that case, the previous subscriber is over-written.The text was updated successfully, but these errors were encountered: