Disable read for downstream by default to avoid timeout before request

This commit is contained in:
Tatsuhiro Tsujikawa 2012-06-10 01:46:33 +09:00
parent c29dd0b80f
commit e871768d84
3 changed files with 5 additions and 2 deletions

View File

@ -82,7 +82,7 @@ int DownstreamConnection::attach_downstream(Downstream *downstream)
downstream->set_downstream_connection(this); downstream->set_downstream_connection(this);
downstream_ = downstream; downstream_ = downstream;
bufferevent_setwatermark(bev_, EV_READ, 0, SHRPX_READ_WARTER_MARK); bufferevent_setwatermark(bev_, EV_READ, 0, SHRPX_READ_WARTER_MARK);
bufferevent_enable(bev_, EV_READ | EV_WRITE); bufferevent_disable(bev_, EV_READ);
bufferevent_setcb(bev_, bufferevent_setcb(bev_,
upstream->get_downstream_readcb(), upstream->get_downstream_readcb(),
upstream->get_downstream_writecb(), upstream->get_downstream_writecb(),
@ -134,7 +134,7 @@ void DownstreamConnection::detach_downstream(Downstream *downstream)
} }
downstream->set_downstream_connection(0); downstream->set_downstream_connection(0);
downstream_ = 0; downstream_ = 0;
bufferevent_enable(bev_, EV_READ | EV_WRITE); bufferevent_disable(bev_, EV_READ);
bufferevent_setcb(bev_, 0, 0, idle_eventcb, this); bufferevent_setcb(bev_, 0, 0, idle_eventcb, this);
client_handler_->pool_downstream_connection(this); client_handler_->pool_downstream_connection(this);
} }

View File

@ -254,6 +254,7 @@ int HttpsUpstream::on_read()
delete downstream; delete downstream;
} else { } else {
pause_read(SHRPX_MSG_BLOCK); pause_read(SHRPX_MSG_BLOCK);
downstream->force_resume_read();
} }
} }
} else if(htperr == htparse_error_none) { } else if(htperr == htparse_error_none) {

View File

@ -180,6 +180,7 @@ void on_ctrl_recv_callback
<< downstream; << downstream;
} }
downstream->set_request_state(Downstream::MSG_COMPLETE); downstream->set_request_state(Downstream::MSG_COMPLETE);
downstream->force_resume_read();
} }
break; break;
} }
@ -220,6 +221,7 @@ void on_data_chunk_recv_callback(spdylay_session *session,
<< downstream; << downstream;
} }
downstream->set_request_state(Downstream::MSG_COMPLETE); downstream->set_request_state(Downstream::MSG_COMPLETE);
downstream->force_resume_read();
} }
} }
} }