2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-08-30 22:15:20 +00:00

address race condition with multiple isc_socket_connect calls in change 4041

This commit is contained in:
Mark Andrews
2015-02-18 23:32:31 +11:00
parent e58eb371a0
commit 6a837e5121
2 changed files with 20 additions and 0 deletions

View File

@@ -3579,6 +3579,15 @@ isc__socket_connect(isc_socket_t *sock, isc_sockaddr_t *addr,
}
ISC_LINK_INIT(cdev, ev_link);
if (sock->connected) {
INSIST(isc_sockaddr_equal(&sock->address, addr));
cdev->result = ISC_R_SUCCESS;
isc_task_send(task, ISC_EVENT_PTR(&cdev));
UNLOCK(&sock->lock);
return (ISC_R_SUCCESS);
}
if ((sock->type == isc_sockettype_tcp) && !sock->pending_connect) {
/*
* Queue io completion for an accept().
@@ -3609,6 +3618,7 @@ isc__socket_connect(isc_socket_t *sock, isc_sockaddr_t *addr,
ISC_LIST_ENQUEUE(sock->connect_list, cdev, ev_link);
sock->pending_iocp++;
} else if (sock->type == isc_sockettype_tcp) {
INSIST(sock->pending_connect);
INSIST(isc_sockaddr_equal(&sock->address, addr));
isc_task_attach(task, &ntask);
cdev->ev_sender = ntask;