comparison src/uicommon/gftpui.c @ 442:9d03253b00d0

2004-3-20 Brian Masney <masneyb@gftp.org> * Officially release 2.0.17pre0 * lib/gftp.h src/uicommon/gftpui.c lib/rfc959.c - if the connection timed out to the server, return GFTP_ETIMEDOUT. In the UI, if this error code is returned, immediately reconnect to the server and retry the operation * lib/rfc959.c - if the return value from rfc959_send_command() is < 0, then make sure the exact value is returned instead of GFTP_ERETRYABLE
author masneyb
date Sat, 20 Mar 2004 19:36:05 +0000
parents c5d14dca70c3
children 83cfffb2878a
comparison
equal deleted inserted replaced
441:f8a0c22af707 442:9d03253b00d0
31 static void * 31 static void *
32 _gftpui_common_thread_callback (void * data) 32 _gftpui_common_thread_callback (void * data)
33 { 33 {
34 intptr_t network_timeout, sleep_time; 34 intptr_t network_timeout, sleep_time;
35 gftpui_callback_data * cdata; 35 gftpui_callback_data * cdata;
36 int success, sj; 36 int success, sj, num_timeouts;
37 37
38 cdata = data; 38 cdata = data;
39 gftp_lookup_request_option (cdata->request, "network_timeout", 39 gftp_lookup_request_option (cdata->request, "network_timeout",
40 &network_timeout); 40 &network_timeout);
41 gftp_lookup_request_option (cdata->request, "sleep_time", 41 gftp_lookup_request_option (cdata->request, "sleep_time",
42 &sleep_time); 42 &sleep_time);
43 43
44 sj = sigsetjmp (gftpui_common_jmp_environment, 1); 44 sj = sigsetjmp (gftpui_common_jmp_environment, 1);
45 gftpui_common_use_jmp_environment = 1; 45 gftpui_common_use_jmp_environment = 1;
46 46
47 num_timeouts = 0;
47 success = GFTP_ERETRYABLE; 48 success = GFTP_ERETRYABLE;
48 if (sj != 1) 49 if (sj != 1)
49 { 50 {
50 while (1) 51 while (1)
51 { 52 {
52 if (network_timeout > 0) 53 if (network_timeout > 0)
53 alarm (network_timeout); 54 alarm (network_timeout);
54 success = cdata->run_function (cdata); 55 success = cdata->run_function (cdata);
55 alarm (0); 56 alarm (0);
57
58 if (success == GFTP_ETIMEDOUT && num_timeouts == 0)
59 {
60 num_timeouts++;
61 if (gftp_connect (cdata->request) == 0)
62 continue;
63 }
56 64
57 if (success == GFTP_EFATAL || success == 0 || cdata->retries == 0) 65 if (success == GFTP_EFATAL || success == 0 || cdata->retries == 0)
58 break; 66 break;
59 67
60 cdata->retries--; 68 cdata->retries--;