From 4c55e8a58f41933e76bcb309206c98e7b5a1d834 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Fri, 9 Sep 2016 10:28:12 -0400 Subject: Fix cases where the tests were doing closesocket() on a non-socket These seem to have caused warnings on windows. Hmmm. --- src/test/test_connection.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/test/test_connection.c') diff --git a/src/test/test_connection.c b/src/test/test_connection.c index bf2cf18b96..d394fc9852 100644 --- a/src/test/test_connection.c +++ b/src/test/test_connection.c @@ -95,6 +95,13 @@ mock_connection_connect_sockaddr(connection_t *conn, return 1; } +static int +fake_close_socket(evutil_socket_t sock) +{ + (void)sock; + return 0; +} + static void test_conn_lookup_addr_helper(const char *address, int family, tor_addr_t *addr) { @@ -124,6 +131,7 @@ test_conn_get_connection(uint8_t state, uint8_t type, uint8_t purpose) MOCK(connection_connect_sockaddr, mock_connection_connect_sockaddr); + MOCK(tor_close_socket, fake_close_socket); init_connection_lists(); @@ -148,12 +156,13 @@ test_conn_get_connection(uint8_t state, uint8_t type, uint8_t purpose) assert_connection_ok(conn, time(NULL)); UNMOCK(connection_connect_sockaddr); - + UNMOCK(tor_close_socket); return conn; /* On failure */ done: UNMOCK(connection_connect_sockaddr); + UNMOCK(tor_close_socket); return NULL; } -- cgit v1.2.3-54-g00ecf