mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-23 22:47:12 +01:00
r18233@catbus: nickm | 2008-02-19 18:46:07 -0500
Count sockets returned from socketpair() too. This is probably not the socket counting bug. svn:r13600
This commit is contained in:
parent
707da4f73f
commit
0399538b90
2 changed files with 11 additions and 0 deletions
|
@ -637,6 +637,16 @@ tor_socketpair(int family, int type, int protocol, int fd[2])
|
|||
#if defined(HAVE_SOCKETPAIR) && !defined(MS_WINDOWS)
|
||||
int r;
|
||||
r = socketpair(family, type, protocol, fd);
|
||||
if (r == 0) {
|
||||
if (fd[0] >= 0) {
|
||||
++n_sockets_open;
|
||||
mark_socket_open(fd[0]);
|
||||
}
|
||||
if (fd[1] >= 0) {
|
||||
++n_sockets_open;
|
||||
mark_socket_open(fd[1]);
|
||||
}
|
||||
}
|
||||
return r < 0 ? -errno : r;
|
||||
#elif defined(USE_BSOCKETS)
|
||||
return bsocketpair(family, type, protocol, fd);
|
||||
|
|
|
@ -366,6 +366,7 @@ _connection_free(connection_t *conn)
|
|||
if (conn->s >= 0) {
|
||||
log_debug(LD_NET,"closing fd %d.",conn->s);
|
||||
tor_close_socket(conn->s);
|
||||
conn->s = -1;
|
||||
}
|
||||
|
||||
if (conn->type == CONN_TYPE_OR &&
|
||||
|
|
Loading…
Add table
Reference in a new issue