Track used site per connection

This commit is contained in:
HelloZeroNet 2016-04-25 02:23:06 +02:00
parent 2a8355dba7
commit 75a5ab9441
3 changed files with 7 additions and 1 deletions

View file

@ -61,6 +61,7 @@ class Peer(object):
if connection: # Connection specified
self.connection = connection
self.connection.sites += 1
else: # Try to find from connection pool or create new connection
self.connection = None
@ -71,6 +72,7 @@ class Peer(object):
self.connection = self.site.connection_server.getConnection(self.ip, self.port, site=self.site)
else:
self.connection = sys.modules["main"].file_server.getConnection(self.ip, self.port, site=self.site)
self.connection.sites += 1
except Exception, err:
self.onConnectionError()