viff

changeset 1210:7eb99c27a46e

Don't output the amount of transferred data when connection closed (interference with trial).
author Marcel Keller <mkeller@cs.au.dk>
date Thu, 10 Sep 2009 18:45:15 +0200
parents ec281b1151e1
children d325a4ee6625 f29e998c77c9
files viff/runtime.py
diffstat 1 files changed, 9 insertions(+), 4 deletions(-) [+]
line diff
     1.1 --- a/viff/runtime.py	Thu Sep 10 18:41:07 2009 +0200
     1.2 +++ b/viff/runtime.py	Thu Sep 10 18:45:15 2009 +0200
     1.3 @@ -296,8 +296,6 @@
     1.4          self.sendString(str(self.factory.runtime.id))
     1.5  
     1.6      def connectionLost(self, reason):
     1.7 -        print "Transfer to peer %d: %d bytes in %d packets" % \
     1.8 -              (self.peer_id, self.sent_bytes, self.sent_packets)
     1.9          reason.trap(ConnectionDone)
    1.10          self.lost_connection.callback(self)
    1.11  
    1.12 @@ -586,7 +584,7 @@
    1.13  
    1.14          def close_connections(_):
    1.15              print "done."
    1.16 -            print "Closing connections..."
    1.17 +            print "Closing connections...",
    1.18              results = [maybeDeferred(self.port.stopListening)]
    1.19              for protocol in self.protocols.itervalues():
    1.20                  results.append(protocol.lost_connection)
    1.21 @@ -594,7 +592,7 @@
    1.22              return DeferredList(results)
    1.23  
    1.24          def stop_reactor(_):
    1.25 -            print "Connections closed."
    1.26 +            print "done."
    1.27              print "Stopping reactor...",
    1.28              reactor.stop()
    1.29              print "done."
    1.30 @@ -870,6 +868,13 @@
    1.31              self.depth_counter -= 1
    1.32              self.activation_counter = 0
    1.33  
    1.34 +    def print_transferred_data():
    1.35 +        """Print the amount of transferred data for all connections."""
    1.36 +
    1.37 +        for protocol in self.protocols.itervalues():
    1.38 +            print "Transfer to peer %d: %d bytes in %d packets" % \
    1.39 +                  (protocol.peer_id, protocol.sent_bytes, protocol.sent_packets)
    1.40 +
    1.41  
    1.42  def make_runtime_class(runtime_class=None, mixins=None):
    1.43      """Creates a new runtime class with *runtime_class* as a base