- Timestamp:
- Aug 20, 2020, 3:38:57 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/downstream.go
r404 r406 865 865 } 866 866 867 seq, ok := history. offlineClients[dc.clientName]867 seq, ok := history.clients[dc.clientName] 868 868 if !ok { 869 869 continue 870 870 } 871 delete(history.offlineClients, dc.clientName) 872 873 // If all clients have received history, no need to keep the 874 // ring buffer around 875 if len(history.offlineClients) == 0 { 876 delete(net.history, target) 877 } 871 history.clients[dc.clientName] = history.ring.Cur() 878 872 879 873 consumer := history.ring.NewConsumer(seq) -
trunk/upstream.go
r405 r406 1636 1636 } 1637 1637 1638 // If no client is offline, no need to append the message to the buffer1639 if len(uc.network.offlineClients) == 0 && !detached {1640 return1641 }1642 1643 1638 history, ok := uc.network.history[entity] 1644 1639 if !ok { 1645 1640 history = &networkHistory{ 1646 offlineClients: make(map[string]uint64),1647 ring: 1641 clients: make(map[string]uint64), 1642 ring: NewRing(uc.srv.RingCap), 1648 1643 } 1649 1644 uc.network.history[entity] = history 1650 1645 1651 1646 for clientName, _ := range uc.network.offlineClients { 1652 history. offlineClients[clientName] = 01647 history.clients[clientName] = 0 1653 1648 } 1654 1649 … … 1657 1652 // clients too 1658 1653 uc.forEachDownstream(func(dc *downstreamConn) { 1659 history. offlineClients[dc.clientName] = 01654 history.clients[dc.clientName] = 0 1660 1655 }) 1661 1656 } … … 1663 1658 1664 1659 history.ring.Produce(msg) 1660 1661 if !detached { 1662 uc.forEachDownstream(func(dc *downstreamConn) { 1663 history.clients[dc.clientName] = history.ring.Cur() 1664 }) 1665 } 1665 1666 } 1666 1667 -
trunk/user.go
r399 r406 52 52 53 53 type networkHistory struct { 54 offlineClients map[string]uint64 // indexed by client name55 ring 54 clients map[string]uint64 // indexed by client name 55 ring *Ring // can be nil if there are no offline clients 56 56 } 57 57 … … 194 194 net.forEachDownstream(func(dc *downstreamConn) { 195 195 net.offlineClients[dc.clientName] = struct{}{} 196 if history != nil {197 history.offlineClients[dc.clientName] = history.ring.Cur()198 }199 196 200 197 dc.SendMessage(&irc.Message{ … … 424 421 425 422 net.offlineClients[dc.clientName] = struct{}{} 426 for target, history := range net.history {427 if ch, ok := net.channels[target]; ok && ch.Detached {428 continue429 }430 history.offlineClients[dc.clientName] = history.ring.Cur()431 }432 423 }) 433 424
Note:
See TracChangeset
for help on using the changeset viewer.