fix p2p topic canonicalization and stale subscriptions
This commit is contained in:
+2
-15
@@ -50,15 +50,8 @@ func (t *Topic) addToPerSubs(topic string, online, enabled bool) {
|
||||
}
|
||||
|
||||
// TODO: maybe skip loading channel subscriptions. They can's send or receive these notifications anyway.
|
||||
|
||||
if uid1, uid2, err := types.ParseP2P(topic); err == nil {
|
||||
// If this is a P2P topic, index it by second user's ID
|
||||
if uid1.UserId() == t.name {
|
||||
topic = uid2.UserId()
|
||||
} else {
|
||||
topic = uid1.UserId()
|
||||
}
|
||||
}
|
||||
// Keep the canonical P2P topic as the key. usr... is accepted only as a
|
||||
// client input alias, while downlink frames should consistently use p2p....
|
||||
|
||||
t.perSubs[topic] = perSubsData{online: online, enabled: enabled}
|
||||
}
|
||||
@@ -544,7 +537,6 @@ func (t *Topic) infoCallSubsOffline(from string, target types.Uid, event string,
|
||||
func presSubsOfflineOffline(tenantID types.TenantID, topic string, cat types.TopicCat, subs []types.Subscription, what string,
|
||||
params *presParams, skipSid string) {
|
||||
|
||||
count := 0
|
||||
original := topic
|
||||
for i := range subs {
|
||||
sub := &subs[i]
|
||||
@@ -554,11 +546,6 @@ func presSubsOfflineOffline(tenantID types.TenantID, topic string, cat types.Top
|
||||
continue
|
||||
}
|
||||
|
||||
if cat == types.TopicCatP2P {
|
||||
original = types.ParseUid(subs[(count+1)%2].User).UserId()
|
||||
count++
|
||||
}
|
||||
|
||||
user := types.ParseUid(sub.User).UserId()
|
||||
actor := params.actor
|
||||
target := params.target
|
||||
|
||||
Reference in New Issue
Block a user