Changeset 665fc6f8c628860cd74a5c029722cd73ee37726f
- Timestamp:
- 07/10/10 08:23:34 (2 months ago)
- Author:
- John M. Schanck <john@…>
- git-author:
- John M. Schanck <john@anomos.info> / 2010-07-10T04:16:06Z-0400
- Parents:
- 216393fca596a821f354f5cb49b06b950d6a073a
- Children:
- c2dcea2a97dd82fac9dd396a4e74f1af9ef0ba35
- git-committer:
- John M. Schanck <john@anomos.info> / 2010-07-10T04:23:34Z-0400
- Message:
-
replaced calls to uniq_id with direct access to uid
- Location:
- Anomos
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r0070651
|
r665fc6f
|
|
| 33 | 33 | def __init__(self, download): |
| 34 | 34 | self.download = download |
| 35 | | self.uid = download.stream.uniq_id() |
| | 35 | self.uid = download.stream.uid |
| 36 | 36 | self.downloader = download.downloader |
| 37 | 37 | self.stats = self.downloader.sstats[self.uid] |
| … |
… |
|
| 327 | 327 | |
| 328 | 328 | def make_download(self, stream): |
| 329 | | uid = stream.uniq_id() |
| | 329 | uid = stream.uid |
| 330 | 330 | sstats = self.sstats.get(uid) |
| 331 | 331 | if sstats is None: |
| … |
… |
|
| 340 | 340 | def lost_peer(self, download): |
| 341 | 341 | self.downloads.remove(download) |
| 342 | | uid = download.stream.uniq_id() |
| | 342 | uid = download.stream.uid |
| 343 | 343 | self.sstats[uid].numstreams -= 1 |
| 344 | 344 | if self.sstats[uid].lastdownload == download: |
| … |
… |
|
| 348 | 348 | if not self.config['retaliate_to_garbled_data']: |
| 349 | 349 | return |
| 350 | | uid = download.stream.uniq_id() |
| | 350 | uid = download.stream.uid |
| 351 | 351 | # kickfunc will schedule stream.close() to be executed later; we |
| 352 | 352 | # might now be inside RawServer event loop with events from that |
-
|
r18f4d42
|
r665fc6f
|
|
| 110 | 110 | self.torrent.handle_exception(e) |
| 111 | 111 | |
| 112 | | def uniq_id(self): |
| 113 | | return self.uid |
| 114 | | |
| 115 | 112 | def send_partial(self, amount): |
| 116 | 113 | """ Provides partial sending of messages for RateLimiter """ |
-
|
r3d9f12e
|
r665fc6f
|
|
| 44 | 44 | ACKBREAK: self.got_ack_break}) |
| 45 | 45 | def invalid_message(self, t): |
| 46 | | log.warning("Invalid message of type %02x on %s. Closing stream."% \ |
| 47 | | (ord(t), self.uniq_id())) |
| | 46 | log.warning("Invalid message of type %02x on %s. Closing stream."% (ord(t), self.uid)) |
| 48 | 47 | self.close() |
| 49 | 48 | def transfer_ctl_msg(self, type, message=""): |
-
|
rc27409d
|
r665fc6f
|
|
| 75 | 75 | t = message[0] |
| 76 | 76 | if self.msgmap.has_key(t): |
| 77 | | #log.info(self.uniq_id() + " got "+mcode_to_name(ord(t))) |
| | 77 | #Uncomment below for extremely verbose message logging |
| | 78 | #log.debug(self.uid + " got "+mcode_to_name(ord(t))) |
| 78 | 79 | if len(message[1:]) > 0: |
| 79 | 80 | self.msgmap[t](message) |
-
|
r18f4d42
|
r665fc6f
|
|
| 146 | 146 | log.error(e) |
| 147 | 147 | #self.torrent.handle_exception(e) |
| 148 | | |
| 149 | | def uniq_id(self): |
| 150 | | return self.uid |
-
|
r1893030
|
r665fc6f
|
|
| 132 | 132 | """Logs a message when the decorated method is called""" |
| 133 | 133 | def ret_fn(self, *args, **kwargs): |
| 134 | | LOG.info(self.uniq_id() + " calling %s" % fn.__name__) |
| | 134 | if hasattr(self, 'uid'): |
| | 135 | LOG.info(self.uid + " calling %s" % fn.__name__) |
| | 136 | else: |
| | 137 | LOG.info("Calling %s" % fn.__name__) |
| 135 | 138 | return fn(self, *args, **kwargs) |
| 136 | 139 | return ret_fn |