Browse Source

Fixed Bad Address error. (send_client_mailbox was using msgbundle_size instead of mailbox_size)

Sajin Sasy 1 year ago
parent
commit
3753edc35a
1 changed files with 9 additions and 8 deletions
  1. 9 8
      App/net.cpp

+ 9 - 8
App/net.cpp

@@ -192,7 +192,7 @@ void NetIO::ing_receive_msgbundle(tcp::socket* csocket, clientid_t c_simid)
                 delete(csocket);
             }
             else {
-                printf("Error %s\n", ec.message().c_str());
+                printf("Error ing_receive_msgbundle : %s\n", ec.message().c_str());
             }
             return;
         }
@@ -231,7 +231,7 @@ void NetIO::ing_authenticate_new_client(tcp::socket* csocket,
                 // Client connection terminated so we delete this socket
                 delete(csocket);
             } else {
-                printf("Error %s\n", ec.message().c_str());
+                printf("Error ing_auth_new_client : %s\n", ec.message().c_str());
             }
             return;
         }
@@ -283,7 +283,7 @@ void NetIO::stg_authenticate_new_client(tcp::socket* csocket,
                 // Client connection terminated so we delete this socket
                 delete(csocket);
             } else {
-                printf("Error %s\n", ec.message().c_str());
+                printf("Error stg_auth_new_client: %s\n", ec.message().c_str());
             }
             return;
         }
@@ -343,7 +343,7 @@ void NetIO::send_client_mailbox()
     for(uint32_t lcid = 0; lcid < num_clients_per_stg; lcid++)
     {
         unsigned char *tkn_ptr = epoch_tokens + lcid * token_bundle_size;
-        unsigned char *buf_ptr = epoch_mailboxes + lcid * msgbundle_size;
+        unsigned char *buf_ptr = epoch_mailboxes + lcid * mailbox_size;
 
         if(client_sockets[lcid]!=nullptr) {
             boost::asio::async_write(*(client_sockets[lcid]),
@@ -353,10 +353,10 @@ void NetIO::send_client_mailbox()
                 if (ec) {
                     if(ec == boost::asio::error::eof) {
                         // Client connection terminated so we delete this socket
-                        // delete(csocket);
+                        delete(client_sockets[lcid]);
                         printf("Client socket terminated!\n");
                     } else {
-                        printf("Error %s\n", ec.message().c_str());
+                        printf("Error send_client_mailbox tokens: %s\n", ec.message().c_str());
                     }
                     return;
                 }
@@ -369,10 +369,11 @@ void NetIO::send_client_mailbox()
                     if (ecc) {
                         if(ecc == boost::asio::error::eof) {
                             // Client connection terminated so we delete this socket
-                            // delete(csocket);
+                            delete(client_sockets[lcid]);
                             printf("Client socket terminated!\n");
                         } else {
-                            printf("Error %s\n", ecc.message().c_str());
+                            printf("Error send_client_mailbox mailbox (lcid = %d): %s\n",
+                                lcid, ecc.message().c_str());
                         }
                         return;
                     }