(self, objectHash = None)
| 111 | self.lastCleared = time.time() |
| 112 | |
| 113 | def add(self, objectHash = None): |
| 114 | with self.lock: |
| 115 | # add a new object into existing thread lists |
| 116 | if objectHash: |
| 117 | if objectHash not in self.hashes: |
| 118 | self.hashes[objectHash] = {'created': time.time(), 'sendCount': 0, 'peers': []} |
| 119 | for thread in threadingEnumerate(): |
| 120 | if thread.isAlive() and hasattr(thread, 'peer') and \ |
| 121 | thread.peer not in self.hashes[objectHash]['peers']: |
| 122 | self.hashes[objectHash]['peers'].append(thread.peer) |
| 123 | # add all objects into the current thread |
| 124 | else: |
| 125 | for objectHash in self.hashes: |
| 126 | if current_thread().peer not in self.hashes[objectHash]['peers']: |
| 127 | self.hashes[objectHash]['peers'].append(current_thread().peer) |
| 128 | |
| 129 | def len(self): |
| 130 | self.clearHashes() |
no outgoing calls
no test coverage detected