Просмотр исходного кода

Minor touchups to client. Clients now send messages to themselves for ease of testing and integrating with private routing

Sajin Sasy 1 год назад
Родитель
Сommit
2d5e752020
1 измененных файлов с 4 добавлено и 12 удалено
  1. 4 12
      Client/clients.cpp

+ 4 - 12
Client/clients.cpp

@@ -326,13 +326,6 @@ void Client::initializeSocket(boost::asio::io_context &ioc,
             " refused, will retry.\n";
         sleep(1);
     }
-
-    /*
-    // Test write 7 to the socket
-    nodenum_t node_num = 7;
-    boost::asio::write(*ingestion_sock,
-        boost::asio::buffer(&node_num, sizeof(node_num)));
-    */
 }
 
 /*
@@ -357,8 +350,8 @@ void Client::generateMessageBundle(uint8_t priv_out, uint32_t msg_size,
     for(uint32_t i = 0; i < priv_out; i++) {
         memcpy(ptr, &id, sizeof(id));
         ptr+=(sizeof(id));
-        memcpy(ptr, &i, sizeof(i));
-        ptr+=(sizeof(i));
+        memcpy(ptr, &id, sizeof(i));
+        ptr+=(sizeof(id));
 
         uint32_t remaining_message_size = msg_size - (sizeof(id)*2);
         memset(ptr, 0, remaining_message_size);
@@ -408,7 +401,7 @@ void Client::sendMessageBundle(uint16_t priv_out, uint16_t msg_size,
 
     encryptMessageBundle(enc_bundle_size, pt_msgbundle, enc_msgbundle);
 
-    //displayPtMessageBundle(pt_msgbundle, priv_out, msg_size);
+    displayPtMessageBundle(pt_msgbundle, priv_out, msg_size);
 
     //displayEncMessageBundle(enc_msgbundle, priv_out, msg_size);
 
@@ -501,7 +494,6 @@ void sendMessageBundles(uint32_t cstart, uint32_t cstop, Client* &clients,
 
     for(uint32_t i=cstart; i<cstop; i++) {
         clients[i].sendMessageBundle(priv_out, msg_size, pt_msgbundle, enc_msgbundle);
-        sleep(2);
     }
 
     free(pt_msgbundle);
@@ -588,7 +580,7 @@ int main(int argc, char **argv)
 
     // Multithreaded client message bundle generation and send
     uint32_t epoch = 0;
-    while(epoch < 3) {
+    while(epoch < 1) {
         for(int i=0; i<nthreads; i++) {
             uint32_t cstart, cstop;
             cstart = i * clients_per_thread;