- Timestamp:
- Feb 10, 2021, 10:31:34 AM (4 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/downstream.go
r450 r451 326 326 } 327 327 328 history, ok := network.history[entity]328 delivered, ok := network.delivered[entity] 329 329 if !ok { 330 330 return 331 331 } 332 332 333 history.clients[dc.clientName] = id333 delivered[dc.clientName] = id 334 334 } 335 335 … … 948 948 949 949 // Fast-forward history to last message 950 for target, history := range net.history{950 for target, delivered := range net.delivered { 951 951 if ch, ok := net.channels[target]; ok && ch.Detached { 952 952 continue … … 958 958 continue 959 959 } 960 history.clients[dc.clientName] = lastID960 delivered[dc.clientName] = lastID 961 961 } 962 962 }) … … 983 983 return 984 984 } 985 for target, history := range net.history{985 for target, delivered := range net.delivered { 986 986 if ch, ok := net.channels[target]; ok && ch.Detached { 987 987 continue 988 988 } 989 989 990 lastDelivered, ok := history.clients[dc.clientName]990 lastDelivered, ok := delivered[dc.clientName] 991 991 if !ok { 992 992 continue -
trunk/upstream.go
r448 r451 1679 1679 } 1680 1680 1681 history, ok := uc.network.history[entity]1681 delivered, ok := uc.network.delivered[entity] 1682 1682 if !ok { 1683 1683 lastID, err := uc.user.msgStore.LastMsgID(uc.network, entity, time.Now()) … … 1687 1687 } 1688 1688 1689 history = &networkHistory{ 1690 clients: make(map[string]string), 1691 } 1692 uc.network.history[entity] = history 1689 delivered = make(map[string]string) 1690 uc.network.delivered[entity] = delivered 1693 1691 1694 1692 for clientName, _ := range uc.network.offlineClients { 1695 history.clients[clientName] = lastID1693 delivered[clientName] = lastID 1696 1694 } 1697 1695 … … 1700 1698 // clients too 1701 1699 uc.forEachDownstream(func(dc *downstreamConn) { 1702 history.clients[dc.clientName] = lastID1700 delivered[dc.clientName] = lastID 1703 1701 }) 1704 1702 } -
trunk/user.go
r450 r451 56 56 type eventStop struct{} 57 57 58 type networkHistory struct {59 clients map[string]string // indexed by client name60 }61 62 58 type network struct { 63 59 Network … … 67 63 conn *upstreamConn 68 64 channels map[string]*Channel 69 history map[string]*networkHistory // indexed by entity70 offlineClients map[string]struct{} // indexed by client name65 delivered map[string]map[string]string // entity -> client name -> msg ID 66 offlineClients map[string]struct{} // indexed by client name 71 67 lastError error 72 68 } … … 84 80 stopped: make(chan struct{}), 85 81 channels: m, 86 history: make(map[string]*networkHistory),82 delivered: make(map[string]map[string]string), 87 83 offlineClients: make(map[string]struct{}), 88 84 } … … 231 227 } 232 228 233 if net.history[ch.Name] != nil{229 if _, ok := net.delivered[ch.Name]; ok { 234 230 dc.sendNetworkBacklog(net) 235 231 }
Note:
See TracChangeset
for help on using the changeset viewer.