Skip to content
Browse files

Fix for TS-1427: PluginVCs now use a 1 second recurring event for ina…

…ctivity checks like UnixNetVConnections
  • Loading branch information...
1 parent 5cf77b2 commit c8392efb7c10c109592ceae980c0ed6a691899d5 Bart Wyatt committed Aug 28, 2012
Showing with 28 additions and 18 deletions.
  1. +3 −0 CHANGES
  2. +22 −16 proxy/PluginVC.cc
  3. +3 −2 proxy/PluginVC.h
View
3 CHANGES
@@ -1,6 +1,9 @@
-*- coding: utf-8 -*-
Changes with Apache Traffic Server 3.3.0
+ *) [TS-1427] PluginVCs now use a method similar to actual socket VCs
+ for firing inactivity timeout events
+
*) [TS-1426] protection from NULL deref when using
TSHttpTxnOutgoingTransparencySet after a user agent has disconnected
View
38 proxy/PluginVC.cc
@@ -97,7 +97,8 @@ magic(PLUGIN_VC_MAGIC_ALIVE), vc_type(PLUGIN_VC_UNKNOWN), core_obj(NULL),
other_side(NULL), read_state(), write_state(),
need_read_process(false), need_write_process(false),
closed(false), sm_lock_retry_event(NULL), core_lock_retry_event(NULL),
-deletable(false), reentrancy_count(0), active_timeout(0), inactive_timeout(0), active_event(NULL), inactive_event(NULL)
+deletable(false), reentrancy_count(0), active_timeout(0), active_event(NULL),
+inactive_timeout(0), inactive_timeout_at(0), inactive_event(NULL)
{
SET_HANDLER(&PluginVC::main_handler);
}
@@ -183,7 +184,10 @@ PluginVC::main_handler(int event, void *data)
if (call_event == active_event) {
process_timeout(call_event, VC_EVENT_ACTIVE_TIMEOUT, &active_event);
} else if (call_event == inactive_event) {
- process_timeout(call_event, VC_EVENT_INACTIVITY_TIMEOUT, &inactive_event);
+ if (inactive_timeout_at && inactive_timeout_at < ink_get_hrtime()) {
+ process_timeout(call_event, VC_EVENT_INACTIVITY_TIMEOUT, &inactive_event);
+ call_event->cancel();
+ }
} else {
if (call_event == sm_lock_retry_event) {
sm_lock_retry_event = NULL;
@@ -710,6 +714,7 @@ PluginVC::process_close()
if (inactive_event) {
inactive_event->cancel();
inactive_event = NULL;
+ inactive_timeout_at = 0;
}
// If the other side of the PluginVC is not closed
// we need to force it process both living sides
@@ -765,9 +770,10 @@ PluginVC::process_timeout(Event * e, int event_to_send, Event ** our_eptr)
void
PluginVC::update_inactive_time()
{
- if (inactive_event) {
- inactive_event->cancel();
- inactive_event = eventProcessor.schedule_in(this, inactive_timeout);
+ if (inactive_event && inactive_timeout) {
+ //inactive_event->cancel();
+ //inactive_event = eventProcessor.schedule_in(this, inactive_timeout);
+ inactive_timeout_at = ink_get_hrtime() + inactive_timeout;
}
}
@@ -831,17 +837,17 @@ void
PluginVC::set_inactivity_timeout(ink_hrtime timeout_in)
{
inactive_timeout = timeout_in;
-
- // FIX - Do we need to handle the case where the timeout is set
- // but no io has been done?
- if (inactive_event) {
- ink_assert(!inactive_event->cancelled);
- inactive_event->cancel();
- inactive_event = NULL;
- }
-
- if (inactive_timeout > 0) {
- inactive_event = eventProcessor.schedule_in(this, inactive_timeout);
+ if (inactive_timeout != 0) {
+ inactive_timeout_at = ink_get_hrtime() + inactive_timeout;
+ if (inactive_event == NULL) {
+ inactive_event = eventProcessor.schedule_every(this, HRTIME_SECONDS(1));
+ }
+ } else {
+ inactive_timeout_at = 0;
+ if (inactive_event) {
+ inactive_event->cancel();
+ inactive_event = NULL;
+ }
}
}
View
5 proxy/PluginVC.h
@@ -152,10 +152,11 @@ class PluginVC:public NetVConnection
int reentrancy_count;
ink_hrtime active_timeout;
- ink_hrtime inactive_timeout;
Event *active_event;
- Event *inactive_event;
+ ink_hrtime inactive_timeout;
+ ink_hrtime inactive_timeout_at;
+ Event *inactive_event;
};
class PluginVCCore:public Continuation

0 comments on commit c8392ef

Please sign in to comment.
Something went wrong with that request. Please try again.