MCPcopy Index your code
hub / github.com/Bitmessage/PyBitmessage / bm_command_addr

Method bm_command_addr

src/network/bmproto.py:376–401  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

374 return self.decode_payload_content("LQIQ16sH")
375
376 def bm_command_addr(self):
377 addresses = self._decode_addr()
378 for i in addresses:
379 seenTime, stream, services, ip, port = i
380 decodedIP = protocol.checkIPAddress(str(ip))
381 if stream not in state.streamsInWhichIAmParticipating:
382 continue
383 if decodedIP is not False and seenTime > time.time() - BMProto.addressAlive:
384 peer = state.Peer(decodedIP, port)
385 try:
386 if knownnodes.knownNodes[stream][peer]["lastseen"] > seenTime:
387 continue
388 except KeyError:
389 pass
390 if len(knownnodes.knownNodes[stream]) < int(BMConfigParser().get("knownnodes", "maxnodes")):
391 with knownnodes.knownNodesLock:
392 try:
393 knownnodes.knownNodes[stream][peer]["lastseen"] = seenTime
394 except (TypeError, KeyError):
395 knownnodes.knownNodes[stream][peer] = {
396 "lastseen": seenTime,
397 "rating": 0,
398 "self": False,
399 }
400 addrQueue.put((stream, peer, self.destination))
401 return True
402
403 def bm_command_portcheck(self):
404 portCheckerQueue.put(state.Peer(self.destination, self.peerNode.port))

Callers

nothing calls this directly

Calls 4

_decode_addrMethod · 0.95
BMConfigParserClass · 0.90
putMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected