You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by we...@apache.org on 2012/10/17 04:45:57 UTC

git commit: TS-1501 vc`s inactivity_timeout event should be schedule in vc`s thread

Updated Branches:
  refs/heads/master a463d3433 -> 68ad34bef


TS-1501 vc`s inactivity_timeout event should be schedule in vc`s thread


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/68ad34be
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/68ad34be
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/68ad34be

Branch: refs/heads/master
Commit: 68ad34bef6ad128bdf692018e0c283869dd260d2
Parents: a463d34
Author: weijin <we...@apache.org>
Authored: Wed Oct 17 10:45:00 2012 +0800
Committer: weijin <we...@apache.org>
Committed: Wed Oct 17 10:45:00 2012 +0800

----------------------------------------------------------------------
 CHANGES                           |    2 ++
 iocore/net/P_UnixNetVConnection.h |   28 ++++++++++++++++++++--------
 iocore/net/UnixNetVConnection.cc  |   10 +++++++---
 3 files changed, 29 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/68ad34be/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index e152dd8..82bfa29 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 3.3.1
   
+  *) [TS-1501] vc`s inactivity_timeout event should be schedule in vc`s thread
+
   *) [TS-1503] make Event::schedule simple and efficient
      Author: KuoTai
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/68ad34be/iocore/net/P_UnixNetVConnection.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UnixNetVConnection.h b/iocore/net/P_UnixNetVConnection.h
index 386f4cd..72df73e 100644
--- a/iocore/net/P_UnixNetVConnection.h
+++ b/iocore/net/P_UnixNetVConnection.h
@@ -291,11 +291,17 @@ UnixNetVConnection::set_inactivity_timeout(ink_hrtime timeout)
     inactivity_timeout->cancel_action(this);
   if (inactivity_timeout_in) {
     if (read.enabled) {
-      ink_debug_assert(read.vio.mutex->thread_holding == this_ethread());
-      inactivity_timeout = read.vio.mutex->thread_holding->schedule_in_local(this, inactivity_timeout_in);
+      ink_debug_assert(read.vio.mutex->thread_holding == this_ethread() && thread);
+      if (read.vio.mutex->thread_holding == thread)
+        inactivity_timeout = thread->schedule_in_local(this, inactivity_timeout_in);
+      else
+        inactivity_timeout = thread->schedule_in(this, inactivity_timeout_in);
     } else if (write.enabled) {
-      ink_debug_assert(write.vio.mutex->thread_holding == this_ethread());
-      inactivity_timeout = write.vio.mutex->thread_holding->schedule_in_local(this, inactivity_timeout_in);
+      ink_debug_assert(write.vio.mutex->thread_holding == this_ethread() && thread);
+      if (write.vio.mutex->thread_holding == thread)
+        inactivity_timeout = thread->schedule_in_local(this, inactivity_timeout_in);
+      else
+        inactivity_timeout = thread->schedule_in(this, inactivity_timeout_in);
     } else
       inactivity_timeout = 0;
   } else
@@ -312,11 +318,17 @@ UnixNetVConnection::set_active_timeout(ink_hrtime timeout)
     active_timeout->cancel_action(this);
   if (active_timeout_in) {
     if (read.enabled) {
-      ink_debug_assert(read.vio.mutex->thread_holding == this_ethread());
-      active_timeout = thread->schedule_in(this, active_timeout_in);
+      ink_debug_assert(read.vio.mutex->thread_holding == this_ethread() && thread);
+      if (read.vio.mutex->thread_holding == thread)
+        active_timeout = thread->schedule_in_local(this, active_timeout_in);
+      else
+        active_timeout = thread->schedule_in(this, active_timeout_in);
     } else if (write.enabled) {
-      ink_debug_assert(write.vio.mutex->thread_holding == this_ethread());
-      active_timeout = thread->schedule_in(this, active_timeout_in);
+      ink_debug_assert(write.vio.mutex->thread_holding == this_ethread() && thread);
+      if (read.vio.mutex->thread_holding == thread)
+        active_timeout = thread->schedule_in_local(this, active_timeout_in);
+      else
+        active_timeout = thread->schedule_in(this, active_timeout_in);
     } else
       active_timeout = 0;
   } else

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/68ad34be/iocore/net/UnixNetVConnection.cc
----------------------------------------------------------------------
diff --git a/iocore/net/UnixNetVConnection.cc b/iocore/net/UnixNetVConnection.cc
index bad8746..33b9ac8 100644
--- a/iocore/net/UnixNetVConnection.cc
+++ b/iocore/net/UnixNetVConnection.cc
@@ -798,12 +798,16 @@ UnixNetVConnection::UnixNetVConnection()
 void
 UnixNetVConnection::set_enabled(VIO *vio)
 {
-  ink_debug_assert(vio->mutex->thread_holding == this_ethread());
+  ink_debug_assert(vio->mutex->thread_holding == this_ethread() && thread);
   ink_assert(!closed);
   STATE_FROM_VIO(vio)->enabled = 1;
 #ifdef INACTIVITY_TIMEOUT
-  if (!inactivity_timeout && inactivity_timeout_in)
-    inactivity_timeout = vio->mutex->thread_holding->schedule_in_local(this, inactivity_timeout_in);
+  if (!inactivity_timeout && inactivity_timeout_in) {
+    if (vio->mutex->thread_holding == thread)
+      inactivity_timeout = thread->schedule_in_local(this, inactivity_timeout_in);
+    else
+      inactivity_timeout = thread->schedule_in(this, inactivity_timeout_in);
+  }
 #else
   if (!next_inactivity_timeout_at && inactivity_timeout_in)
     next_inactivity_timeout_at = ink_get_hrtime() + inactivity_timeout_in;