Make all atomic reads use atomic_ functions

This commit is contained in:
Witold Kręcicki
2019-11-21 09:36:52 +01:00
parent e29980400c
commit a499b77759
4 changed files with 19 additions and 20 deletions

View File

@@ -109,7 +109,7 @@ foreach my $name(@ans) {
stop_signal($name, "TERM", 1);
}
@ans = wait_for_servers(60, @ans);
@ans = wait_for_servers(1200, @ans);
# Pass 3: SIGABRT
foreach my $name (@ns) {

View File

@@ -731,7 +731,6 @@ isc__nmsocket_init(isc_nmsocket_t *sock, isc_nm_t *mgr,
.inactivehandles = isc_astack_new(mgr->mctx, 60),
.inactivereqs = isc_astack_new(mgr->mctx, 60)
};
isc_nm_attach(mgr, &sock->mgr);
sock->uv_handle.handle.data = sock;
@@ -969,27 +968,27 @@ isc_nmhandle_unref(isc_nmhandle_t *handle) {
if (sock->closehandle_cb != NULL) {
if (sock->tid == isc_nm_tid()) {
sock->closehandle_cb(sock);
/*
* If we do this asynchronously then
* the async event will clean it up.
*/
if (sock->ah == 0 &&
!atomic_load(&sock->active) &&
!atomic_load(&sock->destroying))
{
nmsocket_maybe_destroy(sock);
}
} else {
isc__netievent_closecb_t * event =
isc__nm_get_ievent(sock->mgr,
netievent_closecb);
isc_nmsocket_attach(sock, &event->sock);
isc__nm_enqueue_ievent(&sock->mgr->workers[sock->tid],
(isc__netievent_t *) event);
/*
* If we do this asynchronously then the async event
* will clean the socket, so just exit.
*/
return;
}
}
if (atomic_load(&sock->ah) == 0 &&
!atomic_load(&sock->active) &&
!atomic_load(&sock->destroying))
{
nmsocket_maybe_destroy(sock);
}
}
void *

View File

@@ -400,7 +400,7 @@ read_cb(uv_stream_t *stream, ssize_t nread, const uv_buf_t *buf) {
INSIST(sock->rcb.recv != NULL);
sock->rcb.recv(sock->tcphandle, &region, sock->rcbarg);
sock->read_timeout = (sock->keepalive
sock->read_timeout = (atomic_load(&sock->keepalive)
? sock->mgr->keepalive_timeout
: sock->mgr->idle_timeout);

View File

@@ -217,7 +217,7 @@ dnslisten_readcb(isc_nmhandle_t *handle, isc_region_t *region, void *arg) {
memmove(dnssock->buf + dnssock->buf_len, base, len);
dnssock->buf_len += len;
dnssock->read_timeout = (dnssock->keepalive
dnssock->read_timeout = (atomic_load(&dnssock->keepalive)
? dnssock->mgr->keepalive_timeout
: dnssock->mgr->idle_timeout);
@@ -239,7 +239,7 @@ dnslisten_readcb(isc_nmhandle_t *handle, isc_region_t *region, void *arg) {
atomic_store(&dnssock->outer->processing, true);
uv_timer_stop(&dnssock->timer);
if (dnssock->sequential) {
if (atomic_load(&dnssock->sequential)) {
/*
* We're in sequential mode and we processed
* one packet, so we're done until the next read
@@ -348,8 +348,8 @@ isc_nm_tcpdns_keepalive(isc_nmhandle_t *handle) {
return;
}
handle->sock->keepalive = true;
handle->sock->outer->keepalive = true;
atomic_store(&handle->sock->keepalive, true);
atomic_store(&handle->sock->outer->keepalive, true);
}
typedef struct tcpsend {
@@ -384,7 +384,7 @@ resume_processing(void *arg) {
* For sequential sockets: Process what's in the buffer, or
* if there aren't any messages buffered, resume reading.
*/
if (sock->sequential) {
if (atomic_load(&sock->sequential)) {
isc_nmhandle_t *handle = NULL;
result = processbuffer(sock, &handle);