diff options
author | Nick Mathewson <nickm@torproject.org> | 2015-03-31 14:37:09 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-03-31 14:37:09 -0400 |
commit | 30e933b13660e62d10997f4809b3f13235b30325 (patch) | |
tree | 51047f6ec5b72865e0a5fbb0cac60fde115c916a /src/common/compat.c | |
parent | 732322b710d515a55ebbaa984fa12f19ccb333e8 (diff) | |
parent | b49ffb2a21ccbcf62c3e38b822043b4302d8c26f (diff) | |
download | tor-30e933b13660e62d10997f4809b3f13235b30325.tar.gz tor-30e933b13660e62d10997f4809b3f13235b30325.zip |
Merge branch 'ticket14710_squashed'
Diffstat (limited to 'src/common/compat.c')
-rw-r--r-- | src/common/compat.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/common/compat.c b/src/common/compat.c index 1788e32ee3..8da7ef3f69 100644 --- a/src/common/compat.c +++ b/src/common/compat.c @@ -1156,12 +1156,20 @@ mark_socket_open(tor_socket_t s) /** @} */ /** As socket(), but counts the number of open sockets. */ -tor_socket_t -tor_open_socket(int domain, int type, int protocol) +MOCK_IMPL(tor_socket_t, +tor_open_socket,(int domain, int type, int protocol)) { return tor_open_socket_with_extensions(domain, type, protocol, 1, 0); } +/** Mockable wrapper for connect(). */ +MOCK_IMPL(tor_socket_t, +tor_connect_socket,(tor_socket_t socket,const struct sockaddr *address, + socklen_t address_len)) +{ + return connect(socket,address,address_len); +} + /** As socket(), but creates a nonblocking socket and * counts the number of open sockets. */ tor_socket_t @@ -1308,6 +1316,14 @@ get_n_open_sockets(void) return n; } +/** Mockable wrapper for getsockname(). */ +MOCK_IMPL(int, +tor_getsockname,(tor_socket_t socket, struct sockaddr *address, + socklen_t *address_len)) +{ + return getsockname(socket, address, address_len); +} + /** Turn <b>socket</b> into a nonblocking socket. Return 0 on success, -1 * on failure. */ |