Changeset 253 in code for trunk/upstream.go
- Timestamp:
- Apr 10, 2020, 5:22:47 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/upstream.go
r248 r253 557 557 ch.Members[newNick] = membership 558 558 uc.appendLog(ch.Name, msg) 559 uc.appendHistory(ch.Name, msg) 559 560 } 560 561 } 561 562 562 563 if !me { 563 uc.network.ring.Produce(msg)564 564 uc.forEachDownstream(func(dc *downstreamConn) { 565 565 dc.SendMessage(dc.marshalMessage(msg, uc)) … … 663 663 664 664 uc.appendLog(ch.Name, msg) 665 uc.appendHistory(ch.Name, msg) 665 666 } 666 667 } 667 668 668 669 if msg.Prefix.Name != uc.nick { 669 uc.network.ring.Produce(msg)670 670 uc.forEachDownstream(func(dc *downstreamConn) { 671 671 dc.SendMessage(dc.marshalMessage(msg, uc)) … … 1295 1295 } 1296 1296 1297 // appendHistory appends a message to the history. entity can be empty. 1298 func (uc *upstreamConn) appendHistory(entity string, msg *irc.Message) { 1299 // If no client is offline, no need to append the message to the buffer 1300 if len(uc.network.offlineClients) == 0 { 1301 return 1302 } 1303 1304 history, ok := uc.network.history[entity] 1305 if !ok { 1306 history = &networkHistory{ 1307 offlineClients: make(map[string]uint64), 1308 ring: NewRing(uc.srv.RingCap), 1309 } 1310 uc.network.history[entity] = history 1311 1312 for clientName, _ := range uc.network.offlineClients { 1313 history.offlineClients[clientName] = 0 1314 } 1315 } 1316 1317 history.ring.Produce(msg) 1318 } 1319 1297 1320 // produce appends a message to the logs, adds it to the history and forwards 1298 1321 // it to connected downstream connections. … … 1305 1328 } 1306 1329 1307 uc. network.ring.Produce(msg)1330 uc.appendHistory(target, msg) 1308 1331 1309 1332 uc.forEachDownstream(func(dc *downstreamConn) {
Note:
See TracChangeset
for help on using the changeset viewer.