MCPcopy
hub / github.com/HelloZeroNet/ZeroNet / findConnection

Method findConnection

src/Peer/Peer.py:108–115  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

106
107 # Check if we have connection to peer
108 def findConnection(self):
109 if self.connection and self.connection.connected: # We have connection to peer
110 return self.connection
111 else: # Try to find from other sites connections
112 self.connection = self.site.connection_server.getConnection(self.ip, self.port, create=False, site=self.site)
113 if self.connection:
114 self.connection.sites += 1
115 return self.connection
116
117 def __str__(self):
118 return "Peer:%-12s" % self.ip

Callers

nothing calls this directly

Calls 1

getConnectionMethod · 0.80

Tested by

no test coverage detected