static atomic_int_fast64_t csends = ATOMIC_VAR_INIT(0);
static atomic_int_fast64_t creads = ATOMIC_VAR_INIT(0);
static atomic_int_fast64_t ctimeouts = ATOMIC_VAR_INIT(0);
+static atomic_int_fast64_t total_sends = ATOMIC_VAR_INIT(0);
-static atomic_bool was_error;
+static atomic_bool was_error = ATOMIC_VAR_INIT(false);
static unsigned int workers = 0;
#define DOH_PATH "/dns-query"
-#define CHECK_RANGE_FULL(v) \
- { \
- int __v = atomic_load(&v); \
- assert_true(__v > NSENDS * NWRITES * 10 / 100); \
- assert_true(__v <= NSENDS * NWRITES * 110 / 100); \
+#define CHECK_RANGE_FULL(v) \
+ { \
+ int __v = atomic_load(&v); \
+ assert_true(__v >= atomic_load(&total_sends)); \
}
-#define CHECK_RANGE_HALF(v) \
- { \
- int __v = atomic_load(&v); \
- assert_true(__v > NSENDS * NWRITES * 5 / 100); \
- assert_true(__v <= NSENDS * NWRITES * 110 / 100); \
+#define CHECK_RANGE_HALF(v) \
+ { \
+ int __v = atomic_load(&v); \
+ assert_true(__v >= atomic_load(&total_sends) / 2); \
}
/* Enable this to print values while running tests */
close(tcp_listen_sock);
tcp_listen_sock = -1;
- atomic_store(&nsends, NSENDS * NWRITES);
+ atomic_store(&total_sends, NSENDS * NWRITES);
+ atomic_store(&nsends, atomic_load(&total_sends));
atomic_store(&csends, 0);
atomic_store(&creads, 0);
isc_nmsocket_t *listen_sock = NULL;
char req_url[256];
- atomic_store(&nsends, 1);
+ atomic_store(&total_sends, 1);
+ atomic_store(&nsends, atomic_load(&total_sends));
result = isc_nm_listenhttp(
listen_nm, (isc_nmiface_t *)&tcp_listen_addr, 0, NULL,
atomic_load(&use_TLS) ? server_tlsctx : NULL, &listen_sock);
assert_null(listen_sock);
isc__netmgr_shutdown(connect_nm);
+ X(total_sends);
X(csends);
X(creads);
X(sreads);
char req_url[256];
isc_tlsctx_t *ctx = NULL;
- atomic_store(&nsends, 2);
+ atomic_store(&total_sends, 2);
+ atomic_store(&nsends, atomic_load(&total_sends));
result = isc_nm_listenhttp(
listen_nm, (isc_nmiface_t *)&tcp_listen_addr, 0, NULL,
atomic_load(&use_TLS) ? server_tlsctx : NULL, &listen_sock);
assert_null(listen_sock);
isc__netmgr_shutdown(connect_nm);
+ X(total_sends);
X(csends);
X(creads);
X(sreads);
isc_nmsocket_close(&listen_sock);
assert_null(listen_sock);
+ X(total_sends);
X(csends);
X(creads);
X(sreads);
size_t nthreads = ISC_MAX(ISC_MIN(workers, 32), 1);
isc_thread_t threads[32] = { 0 };
- atomic_store(&nsends, (NSENDS * NWRITES) / 2);
+ atomic_store(&total_sends, atomic_load(&total_sends) / 2);
+ atomic_store(&nsends, atomic_load(&total_sends));
result = isc_nm_listenhttp(
listen_nm, (isc_nmiface_t *)&tcp_listen_addr, 0, NULL,
atomic_load(&use_TLS) ? server_tlsctx : NULL, &listen_sock);
isc_nmsocket_close(&listen_sock);
assert_null(listen_sock);
+ X(total_sends);
X(csends);
X(creads);
X(sreads);
size_t nthreads = ISC_MAX(ISC_MIN(workers, 32), 1);
isc_thread_t threads[32] = { 0 };
- atomic_store(&nsends, (NSENDS * NWRITES) / 2);
+ atomic_store(&total_sends, atomic_load(&total_sends) / 2);
+ atomic_store(&nsends, atomic_load(&total_sends));
result = isc_nm_listenhttp(
listen_nm, (isc_nmiface_t *)&tcp_listen_addr, 0, NULL,
atomic_load(&use_TLS) ? server_tlsctx : NULL, &listen_sock);
isc__netmgr_shutdown(connect_nm);
+ X(total_sends);
X(csends);
X(creads);
X(sreads);
size_t nthreads = ISC_MAX(ISC_MIN(workers, 32), 1);
isc_thread_t threads[32] = { 0 };
- atomic_store(&nsends, (NSENDS * NWRITES) / 2);
+ atomic_store(&total_sends, atomic_load(&total_sends) / 2);
+ atomic_store(&nsends, atomic_load(&total_sends));
result = isc_nm_listenhttp(
listen_nm, (isc_nmiface_t *)&tcp_listen_addr, 0, NULL,
atomic_load(&use_TLS) ? server_tlsctx : NULL, &listen_sock);
isc_thread_join(threads[i], NULL);
}
+ X(total_sends);
X(csends);
X(creads);
X(sreads);