Github user tpcwang commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/980#discussion_r59304879
  
    --- Diff: lib/cpp/src/thrift/server/TThreadedServer.h ---
    @@ -83,12 +88,56 @@ class TThreadedServer : public TServerFramework {
       virtual void serve();
     
     protected:
    +  /**
    +   * Drain recently connected clients by joining their threads - this is 
done lazily because
    +   * we cannot do it inside the thread context that is disconnecting.
    +   */
    +  virtual void drainDeadClients();
    +
    +  /**
    +   * Implementation of TServerFramework::onClientConnected
    +   */
       virtual void onClientConnected(const 
boost::shared_ptr<TConnectedClient>& pClient) /* override */;
    -  virtual void onClientDisconnected(TConnectedClient* pClient) /* override 
*/;
    +
    +  /**
    +   * Implementation of TServerFramework::onClientDisconnected
    +   */
    +  virtual void onClientDisconnected(TConnectedClient *pClient) /* override 
*/;
     
       boost::shared_ptr<apache::thrift::concurrency::ThreadFactory> 
threadFactory_;
    -  apache::thrift::concurrency::Monitor clientsMonitor_;
    +
    +  /**
    +   * A helper wrapper used to wrap the client in something we can use to 
maintain
    +   * the lifetime of the connected client within a detached thread.
    --- End diff --
    
    It's not a detached thread anymore, but why is this needed? I think 
ClientMap be a map from TConnectedClient* to 
shared_ptr<apache:thrift::concurrency::Thread> because Thread itself holds on 
to the TConnectedClient and maintains its lifetime since it needs to run it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to