Skip to content

Commit

Permalink
Merge pull request #226 from Castaglia/proxy-list-timeouts-issue130
Browse files Browse the repository at this point in the history
Issue #130: Rather than using `select(2)` on the backend control conn…
  • Loading branch information
Castaglia authored Jul 4, 2022
2 parents 45ef8e6 + d759698 commit 774c3fa
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions mod_proxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -2890,6 +2890,8 @@ MODRET proxy_data(struct proxy_session *proxy_sess, cmd_rec *cmd) {
int frontend_data = FALSE;
conn_t *src_data_conn = NULL, *dst_data_conn = NULL;

pr_signals_handle();

if (data_eof == TRUE ||
xfer_ok == FALSE) {
tv.tv_sec = proxy_sess->linger_timeout;
Expand All @@ -2900,8 +2902,6 @@ MODRET proxy_data(struct proxy_session *proxy_sess, cmd_rec *cmd) {

tv.tv_usec = 0;

pr_signals_handle();

FD_ZERO(&rfds);

/* The source/origin data connection depends on our direction:
Expand Down Expand Up @@ -2989,7 +2989,7 @@ MODRET proxy_data(struct proxy_session *proxy_sess, cmd_rec *cmd) {
if (data_eof == TRUE ||
xfer_ok == FALSE) {

if (data_eof) {
if (data_eof == TRUE) {
/* We've timed out waiting for the end-of-transfer response on the
* backend control connection.
*/
Expand Down Expand Up @@ -3195,11 +3195,13 @@ MODRET proxy_data(struct proxy_session *proxy_sess, cmd_rec *cmd) {
* the data; we need the explicit EOF for that.
*/

if ((data_eof == TRUE || xfer_ok == FALSE) &&
backend_ctrlfd >= 0 &&
FD_ISSET(backend_ctrlfd, &rfds)) {
if (data_eof == TRUE ||
xfer_ok == FALSE) {

/* Hopefully we have some data on the ctrl connection... */
pr_trace_msg(trace_channel, 19,
"handling control connection after data transfer");

/* Some data arrived on the ctrl connection... */
pr_timer_reset(PR_TIMER_IDLE, ANY_MODULE);

resp = proxy_ftp_ctrl_recv_resp(cmd->tmp_pool,
Expand Down

0 comments on commit 774c3fa

Please sign in to comment.