Author: suokko
Date: Sun May 18 20:47:29 2008
New Revision: 26711

URL: http://svn.gna.org/viewcvs/wesnoth?rev=26711&view=rev
Log:
Improved wesnothd performace: Removed transfer stats from server

Modified:
    trunk/src/network_worker.cpp

Modified: trunk/src/network_worker.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/network_worker.cpp?rev=26711&r1=26710&r2=26711&view=diff
==============================================================================
--- trunk/src/network_worker.cpp (original)
+++ trunk/src/network_worker.cpp Sun May 18 20:47:29 2008
@@ -236,7 +236,7 @@
                } else {
 
                        buf += bytes_read;
-                       if(update_stats) {
+                       if(update_stats && !raw_data_only) {
                                const threading::lock lock(*stats_mutex);
                                
transfer_stats[s].second.transfer(static_cast<size_t>(bytes_read));
                        }
@@ -284,6 +284,7 @@
        size_t upto = 0;
        size_t size = buf.size();
 
+       if (!raw_data_only)
        {
                const threading::lock lock(*stats_mutex);
                transfer_stats[sock].first.fresh_current(size);
@@ -302,7 +303,7 @@
                }
                const int res = SDLNet_TCP_Send(sock, &buf[upto], 
static_cast<int>(size - upto));
 
-               if(res == static_cast<int>(size - upto)) {
+               if(!raw_data_only && res == static_cast<int>(size - upto)) {
                        {
                                const threading::lock lock(*stats_mutex);
                                
transfer_stats[sock].first.transfer(static_cast<size_t>(res));
@@ -317,6 +318,7 @@
                {
                        // update how far we are
                        upto += static_cast<size_t>(res);
+                       if (!raw_data_only)
                        {
                                const threading::lock lock(*stats_mutex);
                                
transfer_stats[sock].first.transfer(static_cast<size_t>(res));
@@ -390,6 +392,7 @@
        char* beg = &buf[0];
        const char* const end = beg + len;
 
+       if (!raw_data_only)
        {
                const threading::lock lock(*stats_mutex);
                transfer_stats[sock].second.fresh_current(len);


_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits

Reply via email to