You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2015/01/06 22:34:31 UTC

trafficserver git commit: TS-3275 Clear out event_loop when stop'ing an EventIO

Repository: trafficserver
Updated Branches:
  refs/heads/master 0a2094621 -> b52fc5aa6


TS-3275 Clear out event_loop when stop'ing an EventIO


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

Branch: refs/heads/master
Commit: b52fc5aa6349bed40c13108b5351e27a9b6c391d
Parents: 0a20946
Author: Leif Hedstrom <zw...@apache.org>
Authored: Tue Jan 6 14:08:08 2015 -0700
Committer: Leif Hedstrom <zw...@apache.org>
Committed: Tue Jan 6 14:08:23 2015 -0700

----------------------------------------------------------------------
 CHANGES                |  6 +++++-
 iocore/net/P_UnixNet.h | 11 +++++++----
 2 files changed, 12 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b52fc5aa/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 022cc88..6b925eb 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,7 +1,11 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 5.3.0
 
-  *) [TS-3274] Forward port fix for cache fixup race condition in ram cache from 4.2.X.
+  *) [TS-3275] Clear out event_loop when stop'ing an EventIO. This was as the
+   code originally intended, but was somehow lost.
+
+  *) [TS-3274] Forward port fix for cache fixup race condition in ram cache
+   from 4.2.X.
 
   *) [TS-3225] Add more API support to ts_lua plugin.
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/b52fc5aa/iocore/net/P_UnixNet.h
----------------------------------------------------------------------
diff --git a/iocore/net/P_UnixNet.h b/iocore/net/P_UnixNet.h
index 98060d8..060bc5d 100644
--- a/iocore/net/P_UnixNet.h
+++ b/iocore/net/P_UnixNet.h
@@ -490,6 +490,7 @@ TS_INLINE int EventIO::start(EventLoop l, int afd, Continuation *c, int e) {
 }
 
 TS_INLINE int EventIO::modify(int e) {
+  ink_assert(event_loop);
 #if TS_USE_EPOLL && !defined(USE_EDGE_TRIGGER)
   struct epoll_event ev;
   memset(&ev, 0, sizeof(ev));
@@ -565,6 +566,7 @@ TS_INLINE int EventIO::modify(int e) {
 }
 
 TS_INLINE int EventIO::refresh(int e) {
+  ink_assert(event_loop);
 #if TS_USE_KQUEUE && defined(USE_EDGE_TRIGGER)
   e = e & events;
   struct kevent ev[2];
@@ -605,18 +607,19 @@ TS_INLINE int EventIO::refresh(int e) {
 
 TS_INLINE int EventIO::stop() {
   if (event_loop) {
+    int retval;
 #if TS_USE_EPOLL
     struct epoll_event ev;
     memset(&ev, 0, sizeof(struct epoll_event));
     ev.events = EPOLLIN | EPOLLOUT | EPOLLET;
-    return epoll_ctl(event_loop->epoll_fd, EPOLL_CTL_DEL, fd, &ev);
+    retval = epoll_ctl(event_loop->epoll_fd, EPOLL_CTL_DEL, fd, &ev);
 #endif
 #if TS_USE_PORT
-    int retval = port_dissociate(event_loop->port_fd, PORT_SOURCE_FD, fd);
+    retval = port_dissociate(event_loop->port_fd, PORT_SOURCE_FD, fd);
     Debug("iocore_eventio", "[EventIO::stop] %d[%s]=port_dissociate(%d,%d,%d)", retval, retval<0? strerror(errno) : "ok", event_loop->port_fd, PORT_SOURCE_FD, fd);
-    return retval;
 #endif
-    event_loop = 0;
+    event_loop = NULL;
+    return retval;
   }
   return 0;
 }