Mercurial > hg > nnchat
comparison libnnchat.c @ 355:ba2aa110755b
Add some informational messages to proxy connection setup.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 23 Jun 2011 08:48:23 +0300 |
parents | c01e42fc9adb |
children | 8f3c102db611 |
comparison
equal
deleted
inserted
replaced
354:c01e42fc9adb | 355:ba2aa110755b |
---|---|
223 } | 223 } |
224 th_free(buf); | 224 th_free(buf); |
225 | 225 |
226 /* Wait for SOCKS server to reply */ | 226 /* Wait for SOCKS server to reply */ |
227 for (tries = 0; tries < 20; tries++) { | 227 for (tries = 0; tries < 20; tries++) { |
228 usleep(500); | |
228 status = nn_conn_pull(conn); | 229 status = nn_conn_pull(conn); |
229 if (status <= 0) break; | 230 if (status <= 0) break; |
230 } | 231 } |
231 | 232 |
232 /* Check results */ | 233 /* Check results */ |
245 default: s = "Unknown SOCKS error response"; break; | 246 default: s = "Unknown SOCKS error response"; break; |
246 } | 247 } |
247 nn_conn_err(conn, "SOCKS setup failed, 0x%02x: %s.\n", res->result, s); | 248 nn_conn_err(conn, "SOCKS setup failed, 0x%02x: %s.\n", res->result, s); |
248 goto error; | 249 goto error; |
249 } | 250 } |
250 } | 251 nn_conn_msg(conn, "SOCKS connection established!\n"); |
251 else | 252 } |
253 else if (status < 0) { | |
254 nn_conn_err(conn, "Proxy negotiation failed with network error: %d\n", status); | |
252 goto error; | 255 goto error; |
256 } | |
257 else { | |
258 nn_conn_err(conn, "Proxy negotiation timed out.\n"); | |
259 goto error; | |
260 } | |
253 } | 261 } |
254 | 262 |
255 conn->status = NN_CONN_OPEN; | 263 conn->status = NN_CONN_OPEN; |
256 return 0; | 264 return 0; |
257 | 265 |