Changeset 665fc6f8c628860cd74a5c029722cd73ee37726f

Show
Ignore:
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:
6 modified

Legend:

Unmodified
Added
Removed
  • Anomos/Downloader.py

    r0070651 r665fc6f  
    3333    def __init__(self, download): 
    3434        self.download = download 
    35         self.uid = download.stream.uniq_id() 
     35        self.uid = download.stream.uid 
    3636        self.downloader = download.downloader 
    3737        self.stats = self.downloader.sstats[self.uid] 
     
    327327 
    328328    def make_download(self, stream): 
    329         uid = stream.uniq_id() 
     329        uid = stream.uid 
    330330        sstats = self.sstats.get(uid) 
    331331        if sstats is None: 
     
    340340    def lost_peer(self, download): 
    341341        self.downloads.remove(download) 
    342         uid = download.stream.uniq_id() 
     342        uid = download.stream.uid 
    343343        self.sstats[uid].numstreams -= 1 
    344344        if self.sstats[uid].lastdownload == download: 
     
    348348        if not self.config['retaliate_to_garbled_data']: 
    349349            return 
    350         uid = download.stream.uniq_id() 
     350        uid = download.stream.uid 
    351351        # kickfunc will schedule stream.close() to be executed later; we 
    352352        # might now be inside RawServer event loop with events from that 
  • Anomos/EndPoint.py

    r18f4d42 r665fc6f  
    110110        self.torrent.handle_exception(e) 
    111111 
    112     def uniq_id(self): 
    113         return self.uid 
    114  
    115112    def send_partial(self, amount): 
    116113        """ Provides partial sending of messages for RateLimiter """ 
  • Anomos/Protocol/AnomosEndPointProtocol.py

    r3d9f12e r665fc6f  
    4444                            ACKBREAK: self.got_ack_break}) 
    4545    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)) 
    4847        self.close() 
    4948    def transfer_ctl_msg(self, type, message=""): 
  • Anomos/Protocol/__init__.py

    rc27409d r665fc6f  
    7575        t = message[0] 
    7676        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))) 
    7879            if len(message[1:]) > 0: 
    7980                self.msgmap[t](message) 
  • Anomos/Relayer.py

    r18f4d42 r665fc6f  
    146146        log.error(e) 
    147147        #self.torrent.handle_exception(e) 
    148  
    149     def uniq_id(self): 
    150         return self.uid 
  • Anomos/__init__.py

    r1893030 r665fc6f  
    132132    """Logs a message when the decorated method is called""" 
    133133    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__) 
    135138        return fn(self, *args, **kwargs) 
    136139    return ret_fn