Skip to content

Commit adbf816

Browse files
authored
Merge pull request #874 from openziti/rebind-on-failure
schedule re-bind if binding request fails
2 parents 00e1f96 + e578f2b commit adbf816

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

library/bind.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,11 @@ static void schedule_rebind(struct ziti_conn *conn) {
184184
return;
185185
}
186186

187+
if (conn->server.rebinder.expire_cb != NULL) {
188+
CONN_LOG(DEBUG, "re-bind already scheduled");
189+
return;
190+
}
191+
187192
int backoff = 1 << MIN(conn->server.attempt, 5);
188193
uint32_t random;
189194
uv_random(conn->ziti_ctx->loop, NULL, &random, sizeof(random), 0, NULL);
@@ -505,10 +510,12 @@ static void bind_reply_cb(void *ctx, message *msg, int code) {
505510
(void (*)(void *, message *, int)) on_message);
506511
b->state = st_bound;
507512
} else {
508-
CONN_LOG(DEBUG, "failed to bind on router[%s]", b->ch->name);
513+
CONN_LOG(DEBUG, "failed to bind on router[%s]: %s", b->ch->name,
514+
ziti_errorstr(code));
509515
ziti_channel_rem_receiver(b->ch, b->conn_id);
510516
b->ch = NULL;
511517
b->state = st_unbound;
518+
schedule_rebind(b->conn);
512519
}
513520
}
514521

0 commit comments

Comments
 (0)