diff options
Diffstat (limited to 'src/util/test_connection.c')
-rw-r--r-- | src/util/test_connection.c | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/src/util/test_connection.c b/src/util/test_connection.c index 71b37c8ac..3519522ef 100644 --- a/src/util/test_connection.c +++ b/src/util/test_connection.c | |||
@@ -66,8 +66,7 @@ open_listen_socket () | |||
66 | GNUNET_assert (desc != NULL); | 66 | GNUNET_assert (desc != NULL); |
67 | if (GNUNET_NETWORK_socket_setsockopt | 67 | if (GNUNET_NETWORK_socket_setsockopt |
68 | (desc, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)) != GNUNET_OK) | 68 | (desc, SOL_SOCKET, SO_REUSEADDR, &on, sizeof (on)) != GNUNET_OK) |
69 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, | 69 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, "setsockopt"); |
70 | "setsockopt"); | ||
71 | GNUNET_assert (GNUNET_NETWORK_socket_bind | 70 | GNUNET_assert (GNUNET_NETWORK_socket_bind |
72 | (desc, (const struct sockaddr *) &sa, | 71 | (desc, (const struct sockaddr *) &sa, |
73 | sizeof (sa)) == GNUNET_OK); | 72 | sizeof (sa)) == GNUNET_OK); |
@@ -90,25 +89,24 @@ receive_check (void *cls, | |||
90 | if (0 == memcmp (&"Hello World"[sofar], buf, available)) | 89 | if (0 == memcmp (&"Hello World"[sofar], buf, available)) |
91 | sofar += available; | 90 | sofar += available; |
92 | if (sofar < 12) | 91 | if (sofar < 12) |
93 | { | 92 | { |
94 | #if VERBOSE | 93 | #if VERBOSE |
95 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Receive needs more data\n"); | 94 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Receive needs more data\n"); |
96 | #endif | 95 | #endif |
97 | GNUNET_CONNECTION_receive (asock, | 96 | GNUNET_CONNECTION_receive (asock, |
98 | 1024, | 97 | 1024, |
99 | GNUNET_TIME_relative_multiply | 98 | GNUNET_TIME_relative_multiply |
100 | (GNUNET_TIME_UNIT_SECONDS, 5), | 99 | (GNUNET_TIME_UNIT_SECONDS, 5), |
101 | &receive_check, cls); | 100 | &receive_check, cls); |
102 | } | 101 | } |
103 | else | 102 | else |
104 | { | 103 | { |
105 | #if VERBOSE | 104 | #if VERBOSE |
106 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 105 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Receive closes accepted socket\n"); |
107 | "Receive closes accepted socket\n"); | ||
108 | #endif | 106 | #endif |
109 | *ok = 0; | 107 | *ok = 0; |
110 | GNUNET_CONNECTION_destroy (asock, GNUNET_YES); | 108 | GNUNET_CONNECTION_destroy (asock, GNUNET_YES); |
111 | } | 109 | } |
112 | } | 110 | } |
113 | 111 | ||
114 | 112 | ||
@@ -158,8 +156,7 @@ task (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) | |||
158 | ls = open_listen_socket (); | 156 | ls = open_listen_socket (); |
159 | lsock = GNUNET_CONNECTION_create_from_existing (ls); | 157 | lsock = GNUNET_CONNECTION_create_from_existing (ls); |
160 | GNUNET_assert (lsock != NULL); | 158 | GNUNET_assert (lsock != NULL); |
161 | csock = GNUNET_CONNECTION_create_from_connect (cfg, | 159 | csock = GNUNET_CONNECTION_create_from_connect (cfg, "localhost", PORT); |
162 | "localhost", PORT); | ||
163 | GNUNET_assert (csock != NULL); | 160 | GNUNET_assert (csock != NULL); |
164 | #if VERBOSE | 161 | #if VERBOSE |
165 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test asks for write notification\n"); | 162 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Test asks for write notification\n"); |