Ping is a gRPC endpoint which receives ping requests from peer nodes.Used to detect node restarts.
(ping *ClusterPing, unused *bool)
| 683 | |
| 684 | // Ping is a gRPC endpoint which receives ping requests from peer nodes.Used to detect node restarts. |
| 685 | func (c *Cluster) Ping(ping *ClusterPing, unused *bool) error { |
| 686 | node := c.nodes[ping.Node] |
| 687 | if node == nil { |
| 688 | logs.Warn.Println("cluster Ping from unknown node", ping.Node) |
| 689 | return nil |
| 690 | } |
| 691 | |
| 692 | if node.fingerprint == 0 { |
| 693 | // This is the first connection to remote node. |
| 694 | node.fingerprint = ping.Fingerprint |
| 695 | } else if node.fingerprint != ping.Fingerprint { |
| 696 | // Remote node restarted. |
| 697 | node.fingerprint = ping.Fingerprint |
| 698 | c.invalidateProxySubs(ping.Node) |
| 699 | c.gcProxySessionsForNode(ping.Node) |
| 700 | } |
| 701 | |
| 702 | return nil |
| 703 | } |
| 704 | |
| 705 | // Sends user cache update to user's Master node where the cache actually resides. |
| 706 | // The request is extected to contain users who reside at remote nodes only. |