| 972 | |
| 973 | # Send hashfield to peers |
| 974 | def sendMyHashfield(self, limit=5): |
| 975 | if not self.content_manager.hashfield: # No optional files |
| 976 | return False |
| 977 | |
| 978 | sent = 0 |
| 979 | connected_peers = self.getConnectedPeers() |
| 980 | for peer in connected_peers: |
| 981 | if peer.sendMyHashfield(): |
| 982 | sent += 1 |
| 983 | if sent >= limit: |
| 984 | break |
| 985 | if sent: |
| 986 | my_hashfield_changed = self.content_manager.hashfield.time_changed |
| 987 | self.log.debug("Sent my hashfield (chaged %.3fs ago) to %s peers" % (time.time() - my_hashfield_changed, sent)) |
| 988 | return sent |
| 989 | |
| 990 | # Update hashfield |
| 991 | def updateHashfield(self, limit=5): |