Loading lib/connect.c −28 Changes for lib/connect.c: 0 added lines, 28 removed lines. Original line number Diff line number Diff line Loading @@ -98,34 +98,6 @@ singleipconnect(struct connectdata *conn, curl_socket_t *sock, bool *connected); /* * Curl_timeleft_accept() returns the amount of milliseconds left allowed for * waiting server to connect. If the value is negative, the timeout time has * already elapsed. * * The start time is stored in progress.t_acceptdata - as set with * Curl_pgrsTime(..., TIMER_STARTACCEPT); * */ long Curl_timeleft_accept(struct SessionHandle *data) { long timeout_ms = DEFAULT_ACCEPT_TIMEOUT; struct timeval now; if(data->set.accepttimeout > 0) timeout_ms = data->set.accepttimeout; now = Curl_tvnow(); /* subtract elapsed time */ timeout_ms -= Curl_tvdiff(now, data->progress.t_acceptdata); if(!timeout_ms) /* avoid returning 0 as that means no timeout! */ return -1; return timeout_ms; } /* * Curl_timeleft() returns the amount of milliseconds left allowed for the * transfer/connection. If the value is negative, the timeout time has already Loading lib/connect.h −5 Changes for lib/connect.h: 0 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -43,12 +43,7 @@ long Curl_timeleft(struct SessionHandle *data, struct timeval *nowp, bool duringconnect); /* function that returns how much time there's left to wait for incoming server connect */ long Curl_timeleft_accept(struct SessionHandle *data); #define DEFAULT_CONNECT_TIMEOUT 300000 /* milliseconds == five minutes */ #define DEFAULT_ACCEPT_TIMEOUT 60000 /* milliseconds == one minute */ /* * Used to extract socket and connectdata struct for the most recent Loading lib/ftp.c +40 −2 Changes for lib/ftp.c: 40 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -355,6 +355,44 @@ static CURLcode AcceptServerConnect(struct connectdata *conn) } /* * ftp_timeleft_accept() returns the amount of milliseconds left allowed for * waiting server to connect. If the value is negative, the timeout time has * already elapsed. * * The start time is stored in progress.t_acceptdata - as set with * Curl_pgrsTime(..., TIMER_STARTACCEPT); * */ static long ftp_timeleft_accept(struct SessionHandle *data) { long timeout_ms = DEFAULT_ACCEPT_TIMEOUT; long other; struct timeval now; if(data->set.accepttimeout > 0) timeout_ms = data->set.accepttimeout; now = Curl_tvnow(); /* check if the generic timeout possibly is set shorter */ other = Curl_timeleft(data, &now, FALSE); if(other && (other < timeout_ms)) /* note that this also works fine for when other happens to be negative due to it already having elapsed */ timeout_ms = other; else { /* subtract elapsed time */ timeout_ms -= Curl_tvdiff(now, data->progress.t_acceptdata); if(!timeout_ms) /* avoid returning 0 as that means no timeout! */ return -1; } return timeout_ms; } /*********************************************************************** * * ReceivedServerConnect() Loading @@ -378,7 +416,7 @@ static CURLcode ReceivedServerConnect(struct connectdata* conn, bool* received) *received = FALSE; timeout_ms = Curl_timeleft_accept(data); timeout_ms = ftp_timeleft_accept(data); infof(data, "Checking for server connect\n"); if(timeout_ms < 0) { /* if a timeout was already reached, bail out */ Loading Loading @@ -502,7 +540,7 @@ static CURLcode AllowServerConnect(struct connectdata *conn, bool *connected) Curl_pgrsTime(data, TIMER_STARTACCEPT); for(;;) { timeout_ms = Curl_timeleft_accept(data); timeout_ms = ftp_timeleft_accept(data); if(timeout_ms < 0) { /* if a timeout was already reached, bail out */ failf(data, "Accept timeout occurred while waiting server connect"); Loading lib/ftp.h +2 Changes for lib/ftp.h: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -156,4 +156,6 @@ struct ftp_conn { it */ }; #define DEFAULT_ACCEPT_TIMEOUT 60000 /* milliseconds == one minute */ #endif /* HEADER_CURL_FTP_H */ Loading
lib/connect.c −28 Changes for lib/connect.c: 0 added lines, 28 removed lines. Original line number Diff line number Diff line Loading @@ -98,34 +98,6 @@ singleipconnect(struct connectdata *conn, curl_socket_t *sock, bool *connected); /* * Curl_timeleft_accept() returns the amount of milliseconds left allowed for * waiting server to connect. If the value is negative, the timeout time has * already elapsed. * * The start time is stored in progress.t_acceptdata - as set with * Curl_pgrsTime(..., TIMER_STARTACCEPT); * */ long Curl_timeleft_accept(struct SessionHandle *data) { long timeout_ms = DEFAULT_ACCEPT_TIMEOUT; struct timeval now; if(data->set.accepttimeout > 0) timeout_ms = data->set.accepttimeout; now = Curl_tvnow(); /* subtract elapsed time */ timeout_ms -= Curl_tvdiff(now, data->progress.t_acceptdata); if(!timeout_ms) /* avoid returning 0 as that means no timeout! */ return -1; return timeout_ms; } /* * Curl_timeleft() returns the amount of milliseconds left allowed for the * transfer/connection. If the value is negative, the timeout time has already Loading
lib/connect.h −5 Changes for lib/connect.h: 0 added lines, 5 removed lines. Original line number Diff line number Diff line Loading @@ -43,12 +43,7 @@ long Curl_timeleft(struct SessionHandle *data, struct timeval *nowp, bool duringconnect); /* function that returns how much time there's left to wait for incoming server connect */ long Curl_timeleft_accept(struct SessionHandle *data); #define DEFAULT_CONNECT_TIMEOUT 300000 /* milliseconds == five minutes */ #define DEFAULT_ACCEPT_TIMEOUT 60000 /* milliseconds == one minute */ /* * Used to extract socket and connectdata struct for the most recent Loading
lib/ftp.c +40 −2 Changes for lib/ftp.c: 40 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -355,6 +355,44 @@ static CURLcode AcceptServerConnect(struct connectdata *conn) } /* * ftp_timeleft_accept() returns the amount of milliseconds left allowed for * waiting server to connect. If the value is negative, the timeout time has * already elapsed. * * The start time is stored in progress.t_acceptdata - as set with * Curl_pgrsTime(..., TIMER_STARTACCEPT); * */ static long ftp_timeleft_accept(struct SessionHandle *data) { long timeout_ms = DEFAULT_ACCEPT_TIMEOUT; long other; struct timeval now; if(data->set.accepttimeout > 0) timeout_ms = data->set.accepttimeout; now = Curl_tvnow(); /* check if the generic timeout possibly is set shorter */ other = Curl_timeleft(data, &now, FALSE); if(other && (other < timeout_ms)) /* note that this also works fine for when other happens to be negative due to it already having elapsed */ timeout_ms = other; else { /* subtract elapsed time */ timeout_ms -= Curl_tvdiff(now, data->progress.t_acceptdata); if(!timeout_ms) /* avoid returning 0 as that means no timeout! */ return -1; } return timeout_ms; } /*********************************************************************** * * ReceivedServerConnect() Loading @@ -378,7 +416,7 @@ static CURLcode ReceivedServerConnect(struct connectdata* conn, bool* received) *received = FALSE; timeout_ms = Curl_timeleft_accept(data); timeout_ms = ftp_timeleft_accept(data); infof(data, "Checking for server connect\n"); if(timeout_ms < 0) { /* if a timeout was already reached, bail out */ Loading Loading @@ -502,7 +540,7 @@ static CURLcode AllowServerConnect(struct connectdata *conn, bool *connected) Curl_pgrsTime(data, TIMER_STARTACCEPT); for(;;) { timeout_ms = Curl_timeleft_accept(data); timeout_ms = ftp_timeleft_accept(data); if(timeout_ms < 0) { /* if a timeout was already reached, bail out */ failf(data, "Accept timeout occurred while waiting server connect"); Loading
lib/ftp.h +2 Changes for lib/ftp.h: 2 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -156,4 +156,6 @@ struct ftp_conn { it */ }; #define DEFAULT_ACCEPT_TIMEOUT 60000 /* milliseconds == one minute */ #endif /* HEADER_CURL_FTP_H */