You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zookeeper.apache.org by iv...@apache.org on 2011/11/28 13:15:53 UTC

svn commit: r1207099 - in /zookeeper/bookkeeper/trunk: CHANGES.txt hedwig-client/src/main/cpp/lib/clientimpl.cpp

Author: ivank
Date: Mon Nov 28 12:15:52 2011
New Revision: 1207099

URL: http://svn.apache.org/viewvc?rev=1207099&view=rev
Log:
BOOKKEEPER-118: Hedwig client doesn't kill and remove old subscription channel after redirection. (Sijie Guo via ivank)

Modified:
    zookeeper/bookkeeper/trunk/CHANGES.txt
    zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/clientimpl.cpp

Modified: zookeeper/bookkeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/CHANGES.txt?rev=1207099&r1=1207098&r2=1207099&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/CHANGES.txt (original)
+++ zookeeper/bookkeeper/trunk/CHANGES.txt Mon Nov 28 12:15:52 2011
@@ -108,6 +108,8 @@ BUGFIXES:
 
   BOOKKEEPER-79: randomly startDelivery/stopDelivery will core dump in c++ hedwig client (Sijie Guo via ivank)
 
+  BOOKKEEPER-118: Hedwig client doesn't kill and remove old subscription channel after redirection. (Sijie Guo via ivank)
+
 IMPROVEMENTS:
 
  BOOKKEEPER-28: Create useful startup scripts for bookkeeper and hedwig (ivank)

Modified: zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/clientimpl.cpp
URL: http://svn.apache.org/viewvc/zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/clientimpl.cpp?rev=1207099&r1=1207098&r2=1207099&view=diff
==============================================================================
--- zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/clientimpl.cpp (original)
+++ zookeeper/bookkeeper/trunk/hedwig-client/src/main/cpp/lib/clientimpl.cpp Mon Nov 28 12:15:52 2011
@@ -271,6 +271,13 @@ void ClientImpl::redirectRequest(const D
   DuplexChannelPtr newchannel;
   try {
     if (data->getType() == SUBSCRIBE) {
+      // a redirect for subscription, kill old channel and remove old channel from all channels list
+      // otherwise old channel will not be destroyed, caused lost of CLOSE_WAIT connections
+      channel->kill();
+      {
+        boost::lock_guard<boost::shared_mutex> aclock(allchannels_lock);
+        allchannels.erase(channel); // channel should be deleted here
+      }
       SubscriberClientChannelHandlerPtr handler(new SubscriberClientChannelHandler(shared_from_this(), 
 										   this->getSubscriberImpl(), data));
       newchannel = createChannel(data->getTopic(), handler);