THRIFT-1561 expose #active connections
authorRoger Meier <roger@apache.org>
Wed, 11 Apr 2012 21:43:25 +0000 (21:43 +0000)
committerRoger Meier <roger@apache.org>
Wed, 11 Apr 2012 21:43:25 +0000 (21:43 +0000)
Patch: Dave Watson

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1325024 13f79535-47bb-0310-9956-ffa450edef68

lib/cpp/src/server/TNonblockingServer.h

index 5f5ea11..6b854b5 100644 (file)
@@ -454,6 +454,15 @@ class TNonblockingServer : public TServer {
     return numTConnections_;
   }
 
+  /**
+   * Return the count of sockets currently connected to.
+   *
+   * @return count of connected sockets.
+   */
+  size_t getNumActiveConnections() const {
+    return getNumConnections() - getNumIdleConnections();
+  }
+
   /**
    * Return the count of connection objects allocated but not in use.
    *