(self)
| 273 | return True |
| 274 | |
| 275 | def bm_command_getdata(self): |
| 276 | items = self.decode_payload_content("l32s") |
| 277 | # skip? |
| 278 | if time.time() < self.skipUntil: |
| 279 | return True |
| 280 | #TODO make this more asynchronous |
| 281 | random.shuffle(items) |
| 282 | for i in map(str, items): |
| 283 | if Dandelion().hasHash(i) and \ |
| 284 | self != Dandelion().objectChildStem(i): |
| 285 | self.antiIntersectionDelay() |
| 286 | logger.info('%s asked for a stem object we didn\'t offer to it.', self.destination) |
| 287 | break |
| 288 | else: |
| 289 | try: |
| 290 | self.append_write_buf(protocol.CreatePacket('object', Inventory()[i].payload)) |
| 291 | except KeyError: |
| 292 | self.antiIntersectionDelay() |
| 293 | logger.info('%s asked for an object we don\'t have.', self.destination) |
| 294 | break |
| 295 | # I think that aborting after the first missing/stem object is more secure |
| 296 | # when using random reordering, as the recipient won't know exactly which objects we refuse to deliver |
| 297 | return True |
| 298 | |
| 299 | def _command_inv(self, dandelion=False): |
| 300 | items = self.decode_payload_content("l32s") |
nothing calls this directly
no test coverage detected