mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-29 13:38:26 +00:00
Ignore additional return codes in the netmgr unit tests
There was inconsistency in which error codes would get accepted and ignored in the network manager unit test callbacks. Add following results, so we just detach the handle instead of causing assertion failure: * ISC_R_SHUTTINGDOWN - when the network manager is shutting down * ISC_R_CANCELED - the socket has been shut down * ISC_R_EOF - the (TCP) communication has ended on the other side * ISC_R_CONNECTIONRESET - the TCP connection was reset This should fix some of the spurious unit test failures.
This commit is contained in:
parent
981d6ef1c0
commit
ac4cc8443d
@ -313,20 +313,29 @@ connect_send_cb(isc_nmhandle_t *handle, isc_result_t eresult, void *cbarg) {
|
|||||||
|
|
||||||
F();
|
F();
|
||||||
|
|
||||||
if (eresult != ISC_R_SUCCESS) {
|
switch (eresult) {
|
||||||
|
case ISC_R_EOF:
|
||||||
|
case ISC_R_SHUTTINGDOWN:
|
||||||
|
case ISC_R_CANCELED:
|
||||||
|
case ISC_R_CONNECTIONRESET:
|
||||||
/* Send failed, we need to stop reading too */
|
/* Send failed, we need to stop reading too */
|
||||||
if (stream) {
|
if (stream) {
|
||||||
isc_nm_read_stop(handle);
|
isc_nm_read_stop(handle);
|
||||||
} else {
|
} else {
|
||||||
isc_nm_cancelread(handle);
|
isc_nm_cancelread(handle);
|
||||||
}
|
}
|
||||||
goto unref;
|
break;
|
||||||
}
|
case ISC_R_SUCCESS:
|
||||||
|
|
||||||
if (have_expected_csends(atomic_fetch_add(&csends, 1) + 1)) {
|
if (have_expected_csends(atomic_fetch_add(&csends, 1) + 1)) {
|
||||||
do_csends_shutdown(loopmgr);
|
do_csends_shutdown(loopmgr);
|
||||||
}
|
}
|
||||||
unref:
|
break;
|
||||||
|
default:
|
||||||
|
fprintf(stderr, "%s(%p, %s, %p)\n", __func__, handle,
|
||||||
|
isc_result_totext(eresult), cbarg);
|
||||||
|
assert_int_equal(eresult, ISC_R_SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
isc_refcount_decrement(&active_csends);
|
isc_refcount_decrement(&active_csends);
|
||||||
isc_nmhandle_detach(&sendhandle);
|
isc_nmhandle_detach(&sendhandle);
|
||||||
}
|
}
|
||||||
@ -374,7 +383,6 @@ connect_read_cb(isc_nmhandle_t *handle, isc_result_t eresult,
|
|||||||
case ISC_R_SHUTTINGDOWN:
|
case ISC_R_SHUTTINGDOWN:
|
||||||
case ISC_R_CANCELED:
|
case ISC_R_CANCELED:
|
||||||
case ISC_R_CONNECTIONRESET:
|
case ISC_R_CONNECTIONRESET:
|
||||||
case ISC_R_CONNREFUSED:
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "%s(%p, %s, %p)\n", __func__, handle,
|
fprintf(stderr, "%s(%p, %s, %p)\n", __func__, handle,
|
||||||
@ -433,13 +441,16 @@ listen_send_cb(isc_nmhandle_t *handle, isc_result_t eresult, void *cbarg) {
|
|||||||
isc_refcount_decrement(&active_ssends);
|
isc_refcount_decrement(&active_ssends);
|
||||||
|
|
||||||
switch (eresult) {
|
switch (eresult) {
|
||||||
|
case ISC_R_CANCELED:
|
||||||
|
case ISC_R_CONNECTIONRESET:
|
||||||
|
case ISC_R_EOF:
|
||||||
|
case ISC_R_SHUTTINGDOWN:
|
||||||
|
break;
|
||||||
case ISC_R_SUCCESS:
|
case ISC_R_SUCCESS:
|
||||||
if (have_expected_ssends(atomic_fetch_add(&ssends, 1) + 1)) {
|
if (have_expected_ssends(atomic_fetch_add(&ssends, 1) + 1)) {
|
||||||
do_ssends_shutdown(loopmgr);
|
do_ssends_shutdown(loopmgr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ISC_R_CANCELED:
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "%s(%p, %s, %p)\n", __func__, handle,
|
fprintf(stderr, "%s(%p, %s, %p)\n", __func__, handle,
|
||||||
isc_result_totext(eresult), cbarg);
|
isc_result_totext(eresult), cbarg);
|
||||||
@ -459,9 +470,10 @@ listen_read_cb(isc_nmhandle_t *handle, isc_result_t eresult,
|
|||||||
F();
|
F();
|
||||||
|
|
||||||
switch (eresult) {
|
switch (eresult) {
|
||||||
|
case ISC_R_CANCELED:
|
||||||
|
case ISC_R_CONNECTIONRESET:
|
||||||
case ISC_R_EOF:
|
case ISC_R_EOF:
|
||||||
case ISC_R_SHUTTINGDOWN:
|
case ISC_R_SHUTTINGDOWN:
|
||||||
case ISC_R_CANCELED:
|
|
||||||
break;
|
break;
|
||||||
case ISC_R_SUCCESS:
|
case ISC_R_SUCCESS:
|
||||||
memmove(&magic, region->base, sizeof(magic));
|
memmove(&magic, region->base, sizeof(magic));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user