setAllPeersLost marks all peers as lost. Typically, this is called when we lose connection to the Coordinator. (When we reconnect, we will get NODE updates for all peers that are still connected and mark them as not lost.)
()
| 538 | // the Coordinator. (When we reconnect, we will get NODE updates for all peers that are still connected |
| 539 | // and mark them as not lost.) |
| 540 | func (c *configMaps) setAllPeersLost() { |
| 541 | c.L.Lock() |
| 542 | defer c.L.Unlock() |
| 543 | for _, lc := range c.peers { |
| 544 | if lc.lost { |
| 545 | // skip processing already lost nodes, as this just results in timer churn |
| 546 | continue |
| 547 | } |
| 548 | lc.lost = true |
| 549 | lc.setLostTimer(c) |
| 550 | // it's important to drop a log here so that we see it get marked lost if grepping thru |
| 551 | // the logs for a specific peer |
| 552 | keyID := "(nil node)" |
| 553 | if lc.node != nil { |
| 554 | keyID = lc.node.Key.ShortString() |
| 555 | } |
| 556 | c.logger.Debug(context.Background(), |
| 557 | "setAllPeersLost marked peer lost", |
| 558 | slog.F("peer_id", lc.peerID), |
| 559 | slog.F("key_id", keyID), |
| 560 | ) |
| 561 | } |
| 562 | } |
| 563 | |
| 564 | // peerLostTimeout is the callback that peerLifecycle uses when a peer is lost the timeout to |
| 565 | // receive a handshake fires. |