You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by dr...@apache.org on 2008/07/03 22:29:35 UTC

svn commit: r673791 - in /incubator/thrift/trunk: lib/cpp/src/server/TNonblockingServer.cpp lib/cpp/src/server/TNonblockingServer.h test/cpp/src/TestClient.cpp test/cpp/src/TestServer.cpp

Author: dreiss
Date: Thu Jul  3 13:29:34 2008
New Revision: 673791

URL: http://svn.apache.org/viewvc?rev=673791&view=rev
Log:
(THRIFT-54) Remove "frameResponses" from TNonblockingServer

TNonblockingServer and TFramedTransport used to have the option to only
frame messages on one side of the communication.  This capability was
removed from TFramedTransport because it was poorly implemented and not
useful.  This change removes it from TNonblockingServer as well, and
removes references to it in some of the C++ test code.

Modified:
    incubator/thrift/trunk/lib/cpp/src/server/TNonblockingServer.cpp
    incubator/thrift/trunk/lib/cpp/src/server/TNonblockingServer.h
    incubator/thrift/trunk/test/cpp/src/TestClient.cpp
    incubator/thrift/trunk/test/cpp/src/TestServer.cpp

Modified: incubator/thrift/trunk/lib/cpp/src/server/TNonblockingServer.cpp
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/cpp/src/server/TNonblockingServer.cpp?rev=673791&r1=673790&r2=673791&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/cpp/src/server/TNonblockingServer.cpp (original)
+++ incubator/thrift/trunk/lib/cpp/src/server/TNonblockingServer.cpp Thu Jul  3 13:29:34 2008
@@ -297,20 +297,16 @@
 
     // If the function call generated return data, then move into the send
     // state and get going
+    // 4 bytes were reserved for frame size
     if (writeBufferSize_ > 4) {
 
       // Move into write state
       writeBufferPos_ = 0;
       socketState_ = SOCKET_SEND;
 
-      if (server_->getFrameResponses()) {
-        // Put the frame size into the write buffer
-        int32_t frameSize = (int32_t)htonl(writeBufferSize_ - 4);
-        memcpy(writeBuffer_, &frameSize, 4);
-      } else {
-        // Go straight into sending the result, do not frame it
-        writeBufferPos_ = 4;
-      }
+      // Put the frame size into the write buffer
+      int32_t frameSize = (int32_t)htonl(writeBufferSize_ - 4);
+      memcpy(writeBuffer_, &frameSize, 4);
 
       // Socket into write mode
       appState_ = APP_SEND_RESULT;

Modified: incubator/thrift/trunk/lib/cpp/src/server/TNonblockingServer.h
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/lib/cpp/src/server/TNonblockingServer.h?rev=673791&r1=673790&r2=673791&view=diff
==============================================================================
--- incubator/thrift/trunk/lib/cpp/src/server/TNonblockingServer.h (original)
+++ incubator/thrift/trunk/lib/cpp/src/server/TNonblockingServer.h Thu Jul  3 13:29:34 2008
@@ -49,9 +49,6 @@
   // Port server runs on
   int port_;
 
-  // Whether to frame responses
-  bool frameResponses_;
-
   // For processing via thread pool, may be NULL
   boost::shared_ptr<ThreadManager> threadManager_;
 
@@ -83,7 +80,6 @@
     TServer(processor),
     serverSocket_(-1),
     port_(port),
-    frameResponses_(true),
     threadPoolProcessing_(false),
     eventBase_(NULL),
     numTConnections_(0) {}
@@ -95,7 +91,6 @@
     TServer(processor),
     serverSocket_(-1),
     port_(port),
-    frameResponses_(true),
     threadManager_(threadManager),
     eventBase_(NULL),
     numTConnections_(0) {
@@ -116,7 +111,6 @@
     TServer(processor),
     serverSocket_(0),
     port_(port),
-    frameResponses_(true),
     threadManager_(threadManager),
     eventBase_(NULL),
     numTConnections_(0) {
@@ -146,14 +140,6 @@
     threadManager_->add(task);
   }
 
-  void setFrameResponses(bool frameResponses) {
-    frameResponses_ = frameResponses;
-  }
-
-  bool getFrameResponses() const {
-    return frameResponses_;
-  }
-
   event_base* getEventBase() const {
     return eventBase_;
   }

Modified: incubator/thrift/trunk/test/cpp/src/TestClient.cpp
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/test/cpp/src/TestClient.cpp?rev=673791&r1=673790&r2=673791&view=diff
==============================================================================
--- incubator/thrift/trunk/test/cpp/src/TestClient.cpp (original)
+++ incubator/thrift/trunk/test/cpp/src/TestClient.cpp Thu Jul  3 13:29:34 2008
@@ -37,7 +37,6 @@
   int port = 9090;
   int numTests = 1;
   bool framed = false;
-  bool frameInput = true;
 
   for (int i = 0; i < argc; ++i) {
     if (strcmp(argv[i], "-h") == 0) {
@@ -53,9 +52,6 @@
       numTests = atoi(argv[++i]);
     } else if (strcmp(argv[i], "-f") == 0) {
       framed = true;
-    } else if (strcmp(argv[i], "-fo") == 0) {
-      framed = true;
-      frameInput = false;
     }
   }
 
@@ -66,13 +62,7 @@
 
   if (framed) {
     shared_ptr<TFramedTransport> framedSocket(new TFramedTransport(socket));
-    framedSocket->setRead(frameInput);
     transport = framedSocket;
-    if (frameInput) {
-      printf("Using bi-directional framed transport mode\n");
-    } else {
-      printf("Using framed output only mode\n");
-    }
   } else {
     shared_ptr<TBufferedTransport> bufferedSocket(new TBufferedTransport(socket));
     transport = bufferedSocket;

Modified: incubator/thrift/trunk/test/cpp/src/TestServer.cpp
URL: http://svn.apache.org/viewvc/incubator/thrift/trunk/test/cpp/src/TestServer.cpp?rev=673791&r1=673790&r2=673791&view=diff
==============================================================================
--- incubator/thrift/trunk/test/cpp/src/TestServer.cpp (original)
+++ incubator/thrift/trunk/test/cpp/src/TestServer.cpp Thu Jul  3 13:29:34 2008
@@ -274,7 +274,6 @@
   string serverType = "simple";
   string protocolType = "binary";
   size_t workerCount = 4;
-  bool frameOutput = true;
 
   ostringstream usage;
 
@@ -309,10 +308,6 @@
       port = atoi(args["port"].c_str());
     }
 
-    if (!args["noframe"].empty()) {
-      frameOutput = false;
-    }
-
     if (!args["server-type"].empty()) {
       serverType = args["server-type"];
       if (serverType == "simple") {
@@ -400,18 +395,9 @@
     threadedServer.serve();
 
   } else if (serverType == "nonblocking") {
-
     TNonblockingServer nonblockingServer(testProcessor, port);
-    nonblockingServer.setFrameResponses(frameOutput);
-    if (frameOutput) {
-      printf("Using framed output mode\n");
-    } else {
-      printf("Using non-framed output mode\n");
-    }
-
     printf("Starting the nonblocking server on port %d...\n", port);
     nonblockingServer.serve();
-
   }
 
   printf("done.\n");