Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions proxy/ProxyTransaction.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,23 +80,6 @@ ProxyTransaction::destroy()
this->mutex.clear();
}

// See if we need to schedule on the primary thread for the transaction or change the thread that is associated with the VC.
// If we reschedule, the scheduled action is returned. Otherwise, NULL is returned
Action *
ProxyTransaction::adjust_thread(Continuation *cont, int event, void *data)
{
NetVConnection *vc = this->get_netvc();
EThread *this_thread = this_ethread();
if (vc && vc->thread != this_thread) {
if (vc->thread->is_event_type(ET_NET)) {
return vc->thread->schedule_imm(cont, event, data);
} else { // Not a net thread, take over this thread
vc->thread = this_thread;
}
}
return nullptr;
}

void
ProxyTransaction::set_rx_error_code(ProxyError e)
{
Expand Down
17 changes: 17 additions & 0 deletions proxy/ProxyTransaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -221,3 +221,20 @@ ProxyTransaction::support_sni() const
{
return _proxy_ssn ? _proxy_ssn->support_sni() : false;
}

// See if we need to schedule on the primary thread for the transaction or change the thread that is associated with the VC.
// If we reschedule, the scheduled action is returned. Otherwise, NULL is returned
inline Action *
ProxyTransaction::adjust_thread(Continuation *cont, int event, void *data)
{
NetVConnection *vc = this->get_netvc();
EThread *this_thread = this_ethread();
if (vc && vc->thread != this_thread) {
if (vc->thread->is_event_type(ET_NET)) {
return vc->thread->schedule_imm(cont, event, data);
} else { // Not a net thread, take over this thread
vc->thread = this_thread;
}
}
return nullptr;
}
6 changes: 6 additions & 0 deletions proxy/http/HttpConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -942,6 +942,12 @@ register_stat_callbacks()
(int)http_origin_connections_throttled_stat, RecRawStatSyncCount);
RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.post_body_too_large", RECD_COUNTER, RECP_PERSISTENT,
(int)http_post_body_too_large, RecRawStatSyncCount);
RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.origin.connect.adjust_thread", RECD_COUNTER, RECP_NON_PERSISTENT,
(int)http_origin_connect_adjust_thread_stat, RecRawStatSyncCount);
HTTP_CLEAR_DYN_STAT(http_origin_connect_adjust_thread_stat);
RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.cache.open_write.adjust_thread", RECD_COUNTER, RECP_NON_PERSISTENT,
(int)http_cache_open_write_adjust_thread_stat, RecRawStatSyncCount);
HTTP_CLEAR_DYN_STAT(http_cache_open_write_adjust_thread_stat);
// milestones
RecRegisterRawStat(http_rsb, RECT_PROCESS, "proxy.process.http.milestone.ua_begin", RECD_COUNTER, RECP_PERSISTENT,
(int)http_ua_begin_time_stat, RecRawStatSyncSum);
Expand Down
3 changes: 3 additions & 0 deletions proxy/http/HttpConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,9 @@ enum {

http_origin_connections_throttled_stat,

http_origin_connect_adjust_thread_stat,
http_cache_open_write_adjust_thread_stat,

http_stat_count
};

Expand Down
2 changes: 2 additions & 0 deletions proxy/http/HttpSM.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2451,6 +2451,7 @@ HttpSM::state_cache_open_write(int event, void *data)
pending_action->cancel();
}
if ((pending_action = ua_txn->adjust_thread(this, event, data))) {
HTTP_INCREMENT_DYN_STAT(http_cache_open_write_adjust_thread_stat);
return 0; // Go away if we reschedule
}
}
Expand Down Expand Up @@ -4818,6 +4819,7 @@ HttpSM::do_http_server_open(bool raw)
// Make sure we are on the "right" thread
if (ua_txn) {
if ((pending_action = ua_txn->adjust_thread(this, EVENT_INTERVAL, nullptr))) {
HTTP_INCREMENT_DYN_STAT(http_origin_connect_adjust_thread_stat);
return; // Go away if we reschedule
}
}
Expand Down