Skip to content
Snippets Groups Projects
Commit 91d29203 authored by Martin Stiemerling's avatar Martin Stiemerling :speech_balloon:
Browse files

PeerHandler now checks regularily for peer.

parent f200a63b
No related branches found
No related tags found
1 merge request!9First working draft version
......@@ -74,6 +74,20 @@ func (ph *kmsPeer) PeerHandler(kmsName string) {
log.Printf("Greeting: %s which is now in peerStatus %d", r.GetPeerKmsName(), ph.peerStatus)
// By now, do check only the liveliness of the peer, nothing else.
for {
time.Sleep(30 * time.Second)
// Contact the server and print out its response.
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
r, err := c.ETSICapabilities(ctx, &pb.ETSICapabilitiesRequest{MyKmsName: kmsName})
if err != nil {
log.Printf("could not greet: %v", err)
ph.peerStatus = kmsPeerDown
}
}
}
func (ph *kmsPeer) GetKmsPeerStatus() KmsPeerStatus {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment