mail[Wesnoth-commits] r44865 - in /trunk/src: ana/src/asio_listener.cpp network_ana.cpp network_async.cpp network_manager_ana.cpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by billybiset on July 29, 2010 - 22:01:
Author: billynux
Date: Thu Jul 29 22:01:00 2010
New Revision: 44865

URL: http://svn.gna.org/viewcvs/wesnoth?rev=44865&view=rev
Log:
Removed all debug messages from the ANA implementation of the current network 
API.

Modified:
    trunk/src/ana/src/asio_listener.cpp
    trunk/src/network_ana.cpp
    trunk/src/network_async.cpp
    trunk/src/network_manager_ana.cpp

Modified: trunk/src/ana/src/asio_listener.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/ana/src/asio_listener.cpp?rev=44865&r1=44864&r2=44865&view=diff
==============================================================================
--- trunk/src/ana/src/asio_listener.cpp (original)
+++ trunk/src/ana/src/asio_listener.cpp Thu Jul 29 22:01:00 2010
@@ -215,6 +215,9 @@
 {
     try
     {
+        delete next_message_timer_;
+        next_message_timer_ = NULL;
+
         if (ec)
             disconnect( ec );
         else
@@ -222,8 +225,6 @@
             buf->resize( read_size );
             log_conditional_receive( buf );
             listener_->handle_receive( ec, id(), buf );
-            delete next_message_timer_;
-            next_message_timer_ = NULL;
             listen_one_message();
         }
     }

Modified: trunk/src/network_ana.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/network_ana.cpp?rev=44865&r1=44864&r2=44865&view=diff
==============================================================================
--- trunk/src/network_ana.cpp (original)
+++ trunk/src/network_ana.cpp Thu Jul 29 22:01:00 2010
@@ -90,7 +90,6 @@
 
     connection_stats get_connection_stats(connection connection_num)
     {
-        std::cout << "DEBUG: get_connection_stats\n";
         const ana::stats* stats = ana_manager.get_stats( connection_num );
 
         return connection_stats( stats->bytes_out(),
@@ -100,12 +99,10 @@
 
     error::error(const std::string& msg, connection sock) : message(msg), 
socket(sock)
     {
-        std::cout << "DEBUG: error::error\n";
     }
 
     void error::disconnect()
     {
-        std::cout << "DEBUG: error::disconnect\n";
     }
 
     pending_statistics get_pending_stats()
@@ -116,13 +113,10 @@
     manager::manager(size_t /*min_threads*/, size_t /*max_threads*/) : 
free_(true)
     {
         ++instances_using_the_network_module;
-        std::cout << "DEBUG: Creating a manager object.\n";
     }
 
     manager::~manager()
     {
-        std::cout << "DEBUG: destroying the manager object.\n";
-
         if ( --instances_using_the_network_module == 0 )
             ana_manager.close_connections_and_cleanup();
     }
@@ -135,7 +129,6 @@
         : free_(false),
           connection_(0)
     {
-        std::cout << "DEBUG: server_manager\n";
         if ( create_server != NO_SERVER )
         {
             ana::net_id server_id = ana_manager.create_server( );
@@ -169,13 +162,11 @@
 
     connection connect(const std::string& host, int port)
     {
-        std::cout << "DEBUG: connect\n";
         return ana_manager.create_client_and_connect( host, port );
     }
 
     connection connect(const std::string& host, int port, threading::waiter& 
/*waiter*/)
     {
-        std::cout << "DEBUG: connect2\n";
         return connect( host, port );
     }
 
@@ -207,9 +198,6 @@
 
         network::connection read_id = ana_manager.read_from( connection_num, 
cfg, timeout );
 
-//         if ( read_id != 0 )
-//             std::cout << "Read: " << cfg << "\n";
-
         // TODO: check timeout and return 0, or throw if error occured
 
         return read_id;
@@ -249,11 +237,6 @@
 
     std::string get_bandwidth_stats_all()
     {
-        std::cout << "DEBUG: get_bandwidth_stats_all() for "
-                  << ana_manager.number_of_connections() << " components.\n";
-
-
-
         //TODO: packet_type and widths should be modifiable
         const char*  packet_type  = "network";
 
@@ -276,9 +259,6 @@
 
     std::string get_bandwidth_stats()
     {
-        std::cout << "DEBUG: get_bandwidth_stats() for "
-                  << ana_manager.number_of_connections() << " components.\n";
-
         //TODO: packet_type and widths should be modifiable
         const char*  packet_type  = "network";
 
@@ -301,7 +281,6 @@
 
     std::string get_bandwidth_stats(int hour)
     {
-        std::cout << "DEBUG: get_bandwidth_stats with hour " << hour << "\n";
         return std::string(""); //TODO: implement
     }
 
@@ -329,8 +308,6 @@
         if(cfg.empty())
             return 0;
 
-//         std::cout << "DEBUG: Sending: " << cfg << "\n";
-
         if( connection_num == 0 )
             return ana_manager.send_all( cfg, gzipped );
         else
@@ -342,7 +319,6 @@
                        connection         connection_num,
                        const std::string& /*packet_type*/)
     {
-//         std::cout << "DEBUG: Sending Raw: " << std::string( buf, len ) << 
"\n";
         ana_manager.send_raw_data( buf, size_t( len ), connection_num );
     }
 
@@ -357,19 +333,16 @@
                               const bool          /*gzipped*/,
                               const std::string&  /*packet_type*/)
     {
-//         std::cout << "DEBUG: Sending all except " << connection_num << " 
- " << cfg << "\n";
         ana_manager.send_all_except(cfg, connection_num);
     }
 
     std::string ip_address(connection connection_num)
     {
-        std::cout << "DEBUG: ip_address\n";
         return ana_manager.ip_address( connection_num );
     }
 
     statistics get_send_stats(connection handle)
     {
-        std::cout << "DEBUG: get_send_stats\n";
         return ana_manager.get_send_stats( handle );
     }
 

Modified: trunk/src/network_async.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/network_async.cpp?rev=44865&r1=44864&r2=44865&view=diff
==============================================================================
--- trunk/src/network_async.cpp (original)
+++ trunk/src/network_async.cpp Thu Jul 29 22:01:00 2010
@@ -166,6 +166,7 @@
 
     client_->send( ana::buffer( bos.str()), this );
 
+    client_->expecting_message( ana::time::seconds( 10 ) );
     status_ = PENDING_HANDSHAKE;
 }
 

Modified: trunk/src/network_manager_ana.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/network_manager_ana.cpp?rev=44865&r1=44864&r2=44865&view=diff
==============================================================================
--- trunk/src/network_manager_ana.cpp (original)
+++ trunk/src/network_manager_ana.cpp Thu Jul 29 22:01:00 2010
@@ -37,14 +37,12 @@
     target_calls_( calls ),
     error_code_()
 {
-    std::cout << "DEBUG: Constructing a new ana_send_handler...\n";
     if ( calls > 0 )
         mutex_.lock();
 }
 
 ana_send_handler::~ana_send_handler()
 {
-    std::cout << "DEBUG: Terminating an ana_send_handler...\n";
     if ( target_calls_ > 0 )
         throw std::runtime_error("Handler wasn't called enough times.");
     mutex_.lock();
@@ -103,7 +101,6 @@
     receive_timer_( NULL ),
     finished_( false )
 {
-//     std::cout << "DEBUG: Constructing a new ana_receive_handler...\n"; // 
too much output
     mutex_.lock();
     timeout_called_mutex_.lock();
 }
@@ -208,7 +205,6 @@
     finished_( false )
 {
     throw std::runtime_error("Multiple receive handler constructed");
-    std::cout << "DEBUG: Constructing a new 
ana_multiple_receive_handler...\n";
 
     ana_component_set::iterator it;
 
@@ -319,11 +315,6 @@
 
     if (! finished_ )
     {
-        if (error_code)
-            std::cout << "DEBUG: Receive attempt timed out\n";
-        else
-            std::cout << "DEBUG: Shouldn't reach here\n";
-
         error_code_ = error_code;
         finished_ = true;
         mutex_.unlock();
@@ -339,13 +330,11 @@
     mutex_( ),
     error_code_()
 {
-    std::cout << "DEBUG: Constructing a new ana_connect_handler...\n";
     mutex_.lock();
 }
 
 ana_connect_handler::~ana_connect_handler()
 {
-    std::cout << "DEBUG: Terminating an ana_connect_handler...\n";
     mutex_.lock();
     mutex_.unlock();
 }
@@ -357,11 +346,6 @@
 
 void ana_connect_handler::handle_connect(ana::error_code error_code, 
ana::net_id /*client*/)
 {
-    if (! error_code)
-        std::cout << "DEBUG: Connected.\n";
-    else
-        std::cout << "DEBUG: Can't connect. " << error_code << "\n";
-
     error_code_ = error_code;
     mutex_.unlock();
 }
@@ -549,8 +533,6 @@
 
 void clients_manager::handle_connect(ana::error_code error, ana::net_id 
client)
 {
-    std::cout << "New client connected with id " << client << "\n";
-
     if (! error )
     {
         ids_.insert( client );
@@ -616,8 +598,6 @@
 
 ana::net_id ana_network_manager::create_server( )
 {
-    std::cout << "DEBUG: Creating server.\n";
-
     ana_component* new_component = new ana_component( );
     components_.insert( new_component );
 
@@ -635,8 +615,6 @@
 
 network::connection 
ana_network_manager::create_client_and_connect(std::string host, int port)
 {
-    std::cout << "DEBUG: Creating client and connecting...\n";
-
     try
     {
         std::stringstream ss;
@@ -688,7 +666,6 @@
 
                 bis >> my_id;
                 ana::network_to_host_long( my_id );
-                std::cout << "DEBUG: Received id " << my_id << "\n";
 
                 new_component->set_wesnoth_id( my_id );
 
@@ -701,7 +678,6 @@
     }
     catch( const std::exception& e )
     {
-        std::cout << "DEBUG: Caught an exception while trying to connect.\n";
         return 0;
     }
 }
@@ -860,8 +836,6 @@
 
 size_t ana_network_manager::send_all( const config& cfg, bool zipped )
 {
-    std::cout << "DEBUG: Sending to everybody. " << (zipped ? 
"Zipped":"Raw") << "\n";
-
     const std::string output_string = compress_config(cfg);
 
     std::set<ana_component*>::iterator it;
@@ -884,7 +858,6 @@
             handler.wait_completion();
         }
     }
-    std::cout << "Sent data.\n";
     return output_string.size();
 }
 
@@ -894,8 +867,6 @@
 {
     if ( ! zipped )
         throw std::runtime_error("All send operations should be zipped");
-
-    std::cout << "DEBUG: Single send...\n";
 
     const std::string output_string = compress_config(cfg);
 
@@ -949,8 +920,6 @@
 
 void ana_network_manager::send_all_except(const config& cfg, 
network::connection connection_num)
 {
-    std::cout << "DEBUG: send_all_except " << connection_num << "\n";
-
     const std::string output_string = compress_config(cfg);
 
 
@@ -1124,8 +1093,6 @@
 
 network::statistics ana_network_manager::get_send_stats(network::connection 
handle)
 {
-    std::cout << "DEBUG: in get_send_stats to " << handle << "\n";
-
     if ( handle != 0 )
     {
         ana::net_id id( handle );
@@ -1188,9 +1155,6 @@
         network::disconnect( client );
     else
     {
-        std::cout << "DEBUG: Buffer received with size " << buffer->size()
-                  << " from " << client << "\n";
-
         std::set< ana_component* >::iterator it;
 
         it = std::find_if( components_.begin(), components_.end(),
@@ -1269,8 +1233,6 @@
 
 void ana_network_manager::handle_disconnect(ana::error_code /*error_code*/, 
ana::net_id client)
 {
-    std::cout << "DEBUG: Disconnected from server.\n";
-
     std::set< ana_component* >::iterator it;
 
     it = std::find_if( components_.begin(), components_.end(),
@@ -1278,7 +1240,6 @@
 
     if ( it != components_.end() )
     {
-        std::cout << "DEBUG: Removing bad component.\n";
 //         close_connections_and_cleanup();
         delete *it;
         components_.erase(it);




Related Messages


Powered by MHonArc, Updated Thu Jul 29 22:20:17 2010