Changeset 482 in code for trunk/upstream.go


Ignore:
Timestamp:
Mar 29, 2021, 2:55:57 PM (4 years ago)
Author:
contact
Message:

Simplify network.offlineClients

Replace it with a list of all clients (online or offline).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/upstream.go

    r480 r482  
    17411741        }
    17421742
    1743         detached := false
    1744         if ch := uc.network.channels.Value(entity); ch != nil {
    1745                 detached = ch.Detached
    1746         }
    1747 
    17481743        delivered := uc.network.delivered.Value(entity)
    17491744        entityCM := uc.network.casemap(entity)
    17501745        if delivered == nil {
     1746                // This is the first message we receive from this target. Save the last
     1747                // message ID in delivery receipts, so that we can send the new message
     1748                // in the backlog if an offline client reconnects.
    17511749                lastID, err := uc.user.msgStore.LastMsgID(uc.network, entityCM, time.Now())
    17521750                if err != nil {
     
    17581756                uc.network.delivered.SetValue(entity, delivered)
    17591757
    1760                 for clientName, _ := range uc.network.offlineClients {
     1758                for clientName, _ := range uc.network.clients {
    17611759                        delivered[clientName] = lastID
    1762                 }
    1763 
    1764                 if detached {
    1765                         // If the channel is detached, online clients act as offline
    1766                         // clients too
    1767                         uc.forEachDownstream(func(dc *downstreamConn) {
    1768                                 delivered[dc.clientName] = lastID
    1769                         })
    17701760                }
    17711761        }
Note: See TracChangeset for help on using the changeset viewer.