changeset 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 e694c02d6982
files libnnchat.c
diffstat 1 files changed, 9 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libnnchat.c	Thu Jun 23 08:26:48 2011 +0300
+++ b/libnnchat.c	Thu Jun 23 08:48:23 2011 +0300
@@ -225,6 +225,7 @@
         
         /* Wait for SOCKS server to reply */
         for (tries = 0; tries < 20; tries++) {
+            usleep(500);
             status = nn_conn_pull(conn);
             if (status <= 0) break;
         }
@@ -247,9 +248,16 @@
                 nn_conn_err(conn, "SOCKS setup failed, 0x%02x: %s.\n", res->result, s);
                 goto error;
             }
+            nn_conn_msg(conn, "SOCKS connection established!\n");
         }
-        else
+        else if (status < 0) {
+            nn_conn_err(conn, "Proxy negotiation failed with network error: %d\n", status);
             goto error;
+        }
+        else {
+            nn_conn_err(conn, "Proxy negotiation timed out.\n");
+            goto error;
+        }
     }
 
     conn->status = NN_CONN_OPEN;