Mercurial > hg > th-libs
changeset 119:38a39a9e3a1d
Fix proxy negotiation.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sun, 22 Jun 2014 00:07:25 +0300 |
parents | ca33c6c80176 |
children | 41c2638ee537 |
files | th_network.c |
diffstat | 1 files changed, 15 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/th_network.c Sat Jun 21 23:40:34 2014 +0300 +++ b/th_network.c Sun Jun 22 00:07:25 2014 +0300 @@ -171,7 +171,7 @@ { int status, tries; - for (status = tries = 1; tries <= 20 && status > 0; tries++) + for (status = TH_CONN_NO_DATA, tries = 1; tries <= 20 && status != TH_CONN_DATA_AVAIL; tries++) { #ifdef __WIN32 Sleep(50); @@ -179,15 +179,23 @@ usleep(50000); #endif th_conn_reset(conn); - status = th_conn_pull(conn); + switch (status = th_conn_pull(conn)) + { + case TH_CONN_ERROR: + th_conn_err(conn, status, "Proxy negotiation failed at try %d with network error: %s.\n", + tries, th_error_str(conn->err)); + break; + + case TH_CONN_DATA_AVAIL: + case TH_CONN_NO_DATA: + break; + + default: + return status; + } } if (status != TH_CONN_DATA_AVAIL) - { - th_conn_err(conn, status, "Proxy negotiation failed at try %d with network error: %d\n", - tries, status); - } - else th_conn_err(conn, THERR_TIMED_OUT, "Proxy negotiation timed out.\n"); return status;