Browse Source

Have queue() automatically send() if we have a bunch of full packets of data already

Ian Goldberg 2 years ago
parent
commit
247a5522c5
2 changed files with 6 additions and 7 deletions
  1. 6 0
      mpcio.hpp
  2. 0 7
      preproc.cpp

+ 6 - 0
mpcio.hpp

@@ -116,6 +116,12 @@ public:
 
     void queue(const void *data, size_t len) {
         dataqueue.append((const char *)data, len);
+
+        // If we already have some full packets worth of data, may as
+        // well send it.
+        if (dataqueue.size() > 28800) {
+            send();
+        }
     }
 
     void send() {

+ 0 - 7
preproc.cpp

@@ -83,14 +83,7 @@ void preprocessing_server(MPCServerIO &mpcsrvio, char **args)
         T1 = std::make_tuple(X1, Y1, Z1);
         mpcsrvio.p0io.queue(&T0, sizeof(T0));
         mpcsrvio.p1io.queue(&T1, sizeof(T1));
-        // Flush the queue every so often
-        if ((i % 1000) == 999) {
-            mpcsrvio.p0io.send();
-            mpcsrvio.p1io.send();
-        }
     }
-    mpcsrvio.p0io.send();
-    mpcsrvio.p1io.send();
 
     // That's all
     type = 0x00;