bugfix #286 reschedule reused listening addresses

This commit is contained in:
Willem Toorop 2017-06-01 16:24:24 +02:00
parent 8cef8b1f95
commit a9464993dd
3 changed files with 12 additions and 3 deletions

View File

@ -995,15 +995,16 @@ getdns_return_t getdns_context_set_listen_addresses(
connection *conn;
loop->vmt->clear(loop, &l->to_replace->event);
(void) memset(&l->to_replace->event, 0,
sizeof(getdns_eventloop_event));
l->fd = l->to_replace->fd;
l->event = l->to_replace->event;
l->event.userarg = l;
l->connections = l->to_replace->connections;
for (conn = l->connections; conn; conn = conn->next)
conn->l = l;
(void) memset(&l->to_replace->event, 0,
sizeof(getdns_eventloop_event));
l->to_replace->connections = NULL;
l->to_replace->fd = -1;

View File

@ -119,8 +119,8 @@ int main()
context, listeners, NULL, handler)))
; /* pass */
fprintf(stdout, "%d\n", (int)port2);
fprintf(stdout, "%d\n", (int)port1);
fprintf(stdout, "%d\n", (int)port2);
fflush(stdout);
getdns_context_run(context);
}

View File

@ -13,6 +13,8 @@ make && "${BUILDDIR}/build-stub-only/libtool" exec valgrind -v --log-file=valgri
${GETDNS_STUB_QUERY} -s @127.0.0.1:$PORT TXT test +return_call_reporting 2>&1 > tcp_out
${GETDNS_STUB_QUERY} -s -U @127.0.0.1:$PORT2 TXT test +return_call_reporting 2>&1 > udp_out
${GETDNS_STUB_QUERY} -s -q @127.0.0.1:$PORT TXT quit.
)
if grep -q 'definitely lost: [^0]' valgrind.log
@ -33,6 +35,12 @@ then
echo 'error: Query was not over TCP!'
exit 1
elif ! grep -q '"transport": GETDNS_TRANSPORT_UDP' udp_out
then
cat udp_out
echo 'error: Query was not over UDP!'
exit 1
elif ! grep -q '"Some answer"' tcp_out
then
cat tcp_out