@@ -73,6 +73,12 @@ struct BanEntry
7373};
7474static std::vector<BanEntry> banIPList;
7575
76+ static std::uint64_t totalNumMessagesIn = 0 , totalNumMessagesOut = 0 ;
77+ static std::uint64_t totalBytesIn = 0 , totalBytesOut = 0 ;
78+ static size_t maxClients = 0 , maxChannels = 0 ;
79+ static size_t maxNumMessagesIn = 0 , maxNumMessagesOut = 0 ;
80+ static size_t maxBytesInInOneSec = 0 , maxBytesOutInOneSec = 0 ;
81+
7682static size_t numMessagesIn = 0 , numMessagesOut = 0 ;
7783static size_t bytesIn = 0 , bytesOut = 0 ;
7884struct clientstats
@@ -188,7 +194,7 @@ int main()
188194 (flashpolicypath.empty () ? " Flash not hosting" sv : " Flash policy hosting on TCP port 843" sv) << ' .' <<
189195 std::string (flashpolicypath.empty () ? 30 : 5 , ' ' ) << " \r\n " sv << yellow;
190196
191- globalserver->host (port);
197+ globalserver->host ((lw_ui16) port);
192198
193199 if (!flashpolicypath.empty ())
194200 globalserver->flash ->host (flashpolicypath.c_str ());
@@ -233,7 +239,13 @@ int main()
233239 lw_sync_delete (lw_trace_sync);
234240#endif
235241
236- std::cout << green << timeBuffer << " | Program completed. Press any key to exit.\r\n " sv;
242+ std::wcout << green << timeBuffer << L" | Program completed.\r\n " sv;
243+ std::wcout << timeBuffer << L" | Total bytes: " sv << totalBytesIn << L" in, " sv << totalBytesOut << L" out.\r\n " sv;
244+ std::wcout << timeBuffer << L" | Total msgs: " sv << totalNumMessagesIn << L" in, " sv << totalNumMessagesOut << L" out.\r\n " sv;
245+ std::wcout << timeBuffer << L" | Max msgs in 1 sec: " sv << maxNumMessagesIn << L" in, " sv << maxNumMessagesOut << L" out.\r\n " sv;
246+ std::wcout << timeBuffer << L" | Max bytes in 1 sec: " sv << maxBytesInInOneSec << L" in, " sv << maxBytesOutInOneSec << L" out.\r\n " sv;
247+ std::wcout << timeBuffer << L" | Press any key to exit.\r\n " sv;
248+
237249 // Clear input for getchar()
238250 std::cin.clear ();
239251 std::cin.ignore ();
@@ -257,6 +269,11 @@ void UpdateTitle(size_t clientCount)
257269 // konsole: "\x1B]30;%p1%s\x07";
258270 // screen: "\x1Bk%p1%s\x1B";
259271 std::cout << " \033 ]0;" << name << " \007 " ;
272+
273+ if (maxClients < clientCount)
274+ maxClients = clientCount;
275+ if (maxChannels < channelCount)
276+ maxChannels = channelCount;
260277}
261278
262279void OnConnectRequest (lacewing::relayserver &server, std::shared_ptr<lacewing::relayserver::client> client)
@@ -335,8 +352,22 @@ void OnTimerTick(lacewing::timer timer)
335352 else
336353 strcpy (timeBuffer, " XX:XX:XX" );
337354
355+ totalNumMessagesIn += numMessagesIn;
356+ totalNumMessagesOut += numMessagesOut;
357+ totalBytesIn += bytesIn;
358+ totalBytesOut += bytesOut;
359+ if (maxNumMessagesIn < numMessagesIn)
360+ maxNumMessagesIn = numMessagesIn;
361+ if (maxNumMessagesOut < numMessagesOut)
362+ maxNumMessagesOut = numMessagesOut;
363+ if (maxBytesInInOneSec < bytesIn)
364+ maxBytesInInOneSec = bytesIn;
365+ if (maxBytesOutInOneSec < bytesOut)
366+ maxBytesOutInOneSec = bytesOut;
367+
338368 std::cout << timeBuffer << " | Last sec received " sv << numMessagesIn << " messages (" sv << bytesIn << " bytes), forwarded " sv
339369 << numMessagesOut << " (" sv << bytesOut << " bytes)." sv << std::string (15 , ' ' ) << ' \r ' ;
370+ std::cout.flush ();
340371 numMessagesOut = numMessagesIn = 0U ;
341372 bytesIn = bytesOut = 0U ;
342373
0 commit comments