2
0
mirror of https://gitlab.isc.org/isc-projects/bind9 synced 2025-09-05 00:55:24 +00:00

2419. [cleanup] Document that isc_socket_create() and isc_socket_open()

should not be used for isc_sockettype_fdwatch sockets.
                        [RT #18521]
This commit is contained in:
Mark Andrews
2008-08-20 06:16:07 +00:00
parent cf5b250294
commit 2f420f33bb
4 changed files with 36 additions and 4 deletions

View File

@@ -15,7 +15,7 @@
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: socket.c,v 1.299 2008/08/13 23:44:18 jinmei Exp $ */
/* $Id: socket.c,v 1.300 2008/08/20 06:16:05 marka Exp $ */
/*! \file */
@@ -1847,7 +1847,10 @@ opensocket(isc_socketmgr_t *manager, isc_socket_t *sock) {
sock->fd = socket(sock->pf, SOCK_STREAM, 0);
break;
case isc_sockettype_fdwatch:
INSIST(sock->type != isc_sockettype_fdwatch);
/*
* We should not be called for isc_sockettype_fdwatch sockets.
*/
INSIST(0);
break;
}
if (sock->fd == -1 && errno == EINTR && tries++ < 42)
@@ -2062,6 +2065,7 @@ isc_socket_create(isc_socketmgr_t *manager, int pf, isc_sockettype_t type,
REQUIRE(VALID_MANAGER(manager));
REQUIRE(socketp != NULL && *socketp == NULL);
REQUIRE(type != isc_sockettype_fdwatch);
result = allocate_socket(manager, type, &sock);
if (result != ISC_R_SUCCESS)
@@ -2117,6 +2121,7 @@ isc_socket_open(isc_socket_t *sock) {
LOCK(&sock->lock);
REQUIRE(sock->references == 1);
REQUIRE(sock->type != isc_sockettype_fdwatch);
UNLOCK(&sock->lock);
/*
* We don't need to retain the lock hereafter, since no one else has
@@ -2261,6 +2266,7 @@ isc_socket_close(isc_socket_t *sock) {
LOCK(&sock->lock);
REQUIRE(sock->references == 1);
REQUIRE(sock->type != isc_sockettype_fdwatch);
UNLOCK(&sock->lock);
/*
* We don't need to retain the lock hereafter, since no one else has