forked from extern/smegmesh
main
- Adding retry policy for mobility
This commit is contained in:
parent
bf53108384
commit
d2c8a52ec6
@ -42,8 +42,25 @@ func NewWgCtrlConnection(clientConfig *tls.Config, server string) (PeerConnectio
|
||||
|
||||
// ConnectWithToken: Connects to a new gRPC peer given the address of the other server.
|
||||
func (c *WgCtrlConnection) CreateGrpcConnection() error {
|
||||
retryPolicy := `{
|
||||
"methodConfig": [{
|
||||
"name": [
|
||||
{"service": "syncservice.SyncService"},
|
||||
{"service": "ctrlserver.MeshCtrlServer"}
|
||||
],
|
||||
"waitForReady": true,
|
||||
"retryPolicy": {
|
||||
"MaxAttempts": 2,
|
||||
"InitialBackoff": ".01s",
|
||||
"MaxBackoff": ".01s",
|
||||
"BackoffMultiplier": 1.0,
|
||||
"RetryableStatusCodes": [ "UNAVAILABLE" ]
|
||||
}
|
||||
}]}`
|
||||
|
||||
conn, err := grpc.Dial(c.endpoint,
|
||||
grpc.WithTransportCredentials(credentials.NewTLS(c.clientConfig)))
|
||||
grpc.WithTransportCredentials(credentials.NewTLS(c.clientConfig)),
|
||||
grpc.WithDefaultServiceConfig(retryPolicy))
|
||||
|
||||
if err != nil {
|
||||
logging.Log.WriteErrorf("Could not connect: %s\n", err.Error())
|
||||
|
@ -19,7 +19,7 @@ type ConnectionManager interface {
|
||||
// If the endpoint does not exist then add the connection. Returns an error
|
||||
// if something went wrong
|
||||
GetConnection(endPoint string) (PeerConnection, error)
|
||||
// HasConnections returns true if a client has already registered at the givne
|
||||
// HasConnections returns true if a peer has already registered at the given
|
||||
// endpoint or false otherwise.
|
||||
HasConnection(endPoint string) bool
|
||||
// Goes through all the connections and closes eachone
|
||||
|
Loading…
Reference in New Issue
Block a user