|
@@ -205,6 +205,7 @@ uint64_t NetIO::reset_bytes_sent()
|
|
|
|
|
|
void NetIO::ing_receive_msgbundle(tcp::socket* csocket, clientid_t c_simid)
|
|
|
{
|
|
|
+
|
|
|
unsigned char *msgbundle = (unsigned char*) malloc(msgbundle_size);
|
|
|
|
|
|
boost::asio::async_read(*csocket, boost::asio::buffer(msgbundle, msgbundle_size),
|
|
@@ -231,7 +232,9 @@ void NetIO::ing_receive_msgbundle(tcp::socket* csocket, clientid_t c_simid)
|
|
|
free(msgbundle);
|
|
|
|
|
|
// Continue to async receive client message bundles
|
|
|
- ing_receive_msgbundle(csocket, c_simid);
|
|
|
+ if(ret) {
|
|
|
+ ing_receive_msgbundle(csocket, c_simid);
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
|
|
@@ -369,6 +372,13 @@ void NetIO::stg_start_accept()
|
|
|
|
|
|
void NetIO::send_client_mailbox()
|
|
|
{
|
|
|
+
|
|
|
+#ifdef PROFILE_NET_CLIENTS
|
|
|
+ struct timespec tp;
|
|
|
+ clock_gettime(CLOCK_REALTIME_COARSE, &tp);
|
|
|
+ unsigned long start = tp.tv_sec * 1000000 + tp.tv_nsec/1000;
|
|
|
+#endif
|
|
|
+
|
|
|
// Send each client their tokens for the next epoch
|
|
|
for(uint32_t lcid = 0; lcid < num_clients_per_stg; lcid++)
|
|
|
{
|
|
@@ -416,6 +426,14 @@ void NetIO::send_client_mailbox()
|
|
|
}
|
|
|
*/
|
|
|
}
|
|
|
+
|
|
|
+#ifdef PROFILE_NET_CLIENTS
|
|
|
+ clock_gettime(CLOCK_REALTIME_COARSE, &tp);
|
|
|
+ unsigned long end = tp.tv_sec * 1000000 + tp.tv_nsec/1000;
|
|
|
+ unsigned long diff = end - start;
|
|
|
+ printf("send_client_mailbox time: %lu.%06lu s\n", diff/1000000, diff%1000000);
|
|
|
+#endif
|
|
|
+
|
|
|
}
|
|
|
|
|
|
NetIO::NetIO(boost::asio::io_context &io_context, const Config &config)
|