You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by wa...@apache.org on 2012/08/28 21:57:38 UTC
[1/3] git commit: Fix for TS-1427: PluginVCs now use a 1 second
recurring event for inactivity checks like UnixNetVConnections
Updated Branches:
refs/heads/master 53c74a12e -> c8392efb7
Fix for TS-1427: PluginVCs now use a 1 second recurring event for inactivity checks like UnixNetVConnections
Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/c8392efb
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/c8392efb
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/c8392efb
Branch: refs/heads/master
Commit: c8392efb7c10c109592ceae980c0ed6a691899d5
Parents: 5cf77b2
Author: Bart Wyatt <wa...@apache.org>
Authored: Tue Aug 28 14:48:27 2012 -0500
Committer: Bart Wyatt <wa...@apache.org>
Committed: Tue Aug 28 14:48:27 2012 -0500
----------------------------------------------------------------------
CHANGES | 3 +++
proxy/PluginVC.cc | 38 ++++++++++++++++++++++----------------
proxy/PluginVC.h | 5 +++--
3 files changed, 28 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c8392efb/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 03c6c09..0cda7d6 100644
--- a/CHANGES
+++ b/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
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c8392efb/proxy/PluginVC.cc
----------------------------------------------------------------------
diff --git a/proxy/PluginVC.cc b/proxy/PluginVC.cc
index 5ce1bcb..8df3262 100644
--- a/proxy/PluginVC.cc
+++ b/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;
+ }
}
}
http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c8392efb/proxy/PluginVC.h
----------------------------------------------------------------------
diff --git a/proxy/PluginVC.h b/proxy/PluginVC.h
index d953741..6d0781b 100644
--- a/proxy/PluginVC.h
+++ b/proxy/PluginVC.h
@@ -152,10 +152,11 @@ private:
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