udp: improve udp_bind_double
This commit is contained in:
parent
6e82328003
commit
32b51737ba
1 changed files with 7 additions and 3 deletions
10
src/udp.c
10
src/udp.c
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue