Changeset 406 in code for trunk/user.go


Ignore:
Timestamp:
Aug 20, 2020, 3:38:57 PM (5 years ago)
Author:
contact
Message:

Replace networkHistory.offlineClients with clients

Keep the ring buffer alive even if all clients are connected. Keep the
ID of the latest delivered message even for online clients.

As-is, this is a net downgrade: memory usage increases because ring
buffers aren't free'd anymore. However upcoming commits will replace the
ring buffer with log files. This change makes reading from log files
easier.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/user.go

    r399 r406  
    5252
    5353type networkHistory struct {
    54         offlineClients map[string]uint64 // indexed by client name
    55         ring           *Ring             // can be nil if there are no offline clients
     54        clients map[string]uint64 // indexed by client name
     55        ring    *Ring             // can be nil if there are no offline clients
    5656}
    5757
     
    194194                        net.forEachDownstream(func(dc *downstreamConn) {
    195195                                net.offlineClients[dc.clientName] = struct{}{}
    196                                 if history != nil {
    197                                         history.offlineClients[dc.clientName] = history.ring.Cur()
    198                                 }
    199196
    200197                                dc.SendMessage(&irc.Message{
     
    424421
    425422                                net.offlineClients[dc.clientName] = struct{}{}
    426                                 for target, history := range net.history {
    427                                         if ch, ok := net.channels[target]; ok && ch.Detached {
    428                                                 continue
    429                                         }
    430                                         history.offlineClients[dc.clientName] = history.ring.Cur()
    431                                 }
    432423                        })
    433424
Note: See TracChangeset for help on using the changeset viewer.