from time import localtime, strftime
+
+
+
# Written by Bram Cohen, Pawel Garbacki and Arno Bakker
# see LICENSE.txt for license information
def close(self):
if DEBUG:
- print >>sys.strderr, 'connection closed'
+ print >>sys.stderr, strftime("%d-%m-%Y %H:%M:%S", localtime())," ", 'connection closed'
if self.get_ip() == self.connecter.tracker_ip:
print >>sys.stderr, strftime("%d-%m-%Y %H:%M:%S", localtime())," ","connecter: close: live: WAAH closing SOURCE"
self._send_message(CANCEL + tobinary(index) +
tobinary(begin) + tobinary(length))
if DEBUG_NORMAL_MSGS:
+ #print >>sys.stderr, strftime("%d-%m-%Y %H:%M:%S", localtime())," ", 'sent cancel: '+str(index)+': '+str(begin)+'-'+str(begin+length)
print >>sys.strderr, 'sent cancel: '+str(index)+': '+str(begin)+'-'+str(begin+length)
def send_bitfield(self, bitfield):
tobinary(len(piece) + 9), PIECE,
tobinary(index), tobinary(begin), piece.tostring()))
if DEBUG_NORMAL_MSGS:
- print >>sys.strderr, 'sending chunk: '+str(index)+': '+str(begin)+'-'+str(begin+len(piece))
+ print >>sys.stderr, strftime("%d-%m-%Y %H:%M:%S", localtime())," ", 'sending chunk: '+str(index)+': '+str(begin)+'-'+str(begin+len(piece))
if bytes < len(self.partial_message):
self.connection.send_message_raw(self.partial_message[:bytes])
return not self.connection.is_flushed()
def got_request(self, i, p, l):
+
self.upload.got_request(i, p, l)
if self.just_unchoked:
self.connecter.ratelimiter.ping(clock() - self.just_unchoked)