Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
udp: improve udp_bind_double
  • Loading branch information
perexg committed Oct 26, 2014
1 parent 6e82328 commit 32b5173
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/udp.c
Expand Up @@ -291,9 +291,8 @@ udp_bind_double ( udp_connection_t **_u1, udp_connection_t **_u2,
const char *ifname, int rxsize1, int rxsize2 )
{
udp_connection_t *u1 = NULL, *u2 = NULL;
udp_connection_t *ucs[10] = { NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL };
int pos = 0, i, port2;
udp_connection_t *ucs[10];
int tst = 40, pos = 0, i, port2;

memset(&ucs, 0, sizeof(ucs));
while (1) {
Expand All @@ -307,6 +306,11 @@ udp_bind_double ( udp_connection_t **_u1, udp_connection_t **_u2,
if (u2 != NULL && u2 != UDP_FATAL_ERROR)
break;
}
if (tst) {
udp_close(u1);
tst--;
continue;
}
ucs[pos++] = u1;
if (port || pos >= ARRAY_SIZE(ucs))
goto fail;
Expand Down

0 comments on commit 32b5173

Please sign in to comment.