Skip to content

Commit

Permalink
Merge pull request #189 from glazychev-art/fix_vl3_ipam
Browse files Browse the repository at this point in the history
Fix vl3-ipam RPC call
  • Loading branch information
denis-tingaikin authored May 5, 2023
2 parents a1b244d + 0b08610 commit 9b64879
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,12 +130,25 @@ func (c *Config) Process() error {
func startListenPrefixes(ctx context.Context, c *Config, tlsClientConfig *tls.Config, subscriptions []chan *ipam.PrefixResponse) {
var previousResponse *ipam.PrefixResponse
go func() {
for ; ctx.Err() == nil; time.Sleep(time.Millisecond * 200) {
cc, err := grpc.DialContext(ctx, grpcutils.URLToTarget(&c.PrefixServerURL), grpc.WithTransportCredentials(
credentials.NewTLS(
tlsClientConfig,
var cc *grpc.ClientConn
var err error
for ctx.Err() == nil {
// Close the previous clientConn
if cc != nil {
_ = cc.Close()
}
dialCtx, dialCtxCancel := context.WithTimeout(ctx, time.Millisecond*200)
cc, err = grpc.DialContext(dialCtx,
grpcutils.URLToTarget(&c.PrefixServerURL),
grpc.WithBlock(),
grpc.WithTransportCredentials(
credentials.NewTLS(
tlsClientConfig,
),
),
))
)
// It is safe to cancel dial ctx after DialContext if WithBlock() option is used
dialCtxCancel()
if err != nil {
logrus.Error(err.Error())
continue
Expand Down

0 comments on commit 9b64879

Please sign in to comment.