Skip to content

Commit

Permalink
Try reconnecting if bind to a local interface fails.
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
  • Loading branch information
sustrik committed Nov 16, 2014
1 parent 1fb3641 commit 52cc85c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/transports/tcp/ctcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,11 @@ static void nn_ctcp_start_connecting (struct nn_ctcp *self,

/* Bind the socket to the local network interface. */
rc = nn_usock_bind (&self->usock, (struct sockaddr*) &local, locallen);
errnum_assert (rc == 0, -rc);
if (nn_slow (rc != 0)) {
nn_backoff_start (&self->retry);
self->state = NN_CTCP_STATE_WAITING;
return;
}

/* Start connecting. */
nn_usock_connect (&self->usock, (struct sockaddr*) &remote, remotelen);
Expand Down

0 comments on commit 52cc85c

Please sign in to comment.