site connection stats, msgpack unpacker stats, make sure we dont skip any namecoin blocks, no more sha1 hash to content.json, keep 5 open connection in passive mode, publish got content to 5 peers, upnp retry 3 times, keep connection loggers

This commit is contained in:
HelloZeroNet 2015-04-03 02:47:51 +02:00
parent 2491814070
commit 9c5176a8cb
7 changed files with 70 additions and 11 deletions

View file

@ -79,8 +79,7 @@ class Connection:
try:
firstchar = sock.recv(1) # Find out if pure socket or zeromq
except Exception, err:
if self.log:
self.log.debug("Socket firstchar error: %s" % Debug.formatException(err))
self.log.debug("Socket firstchar error: %s" % Debug.formatException(err))
self.close()
return False
if firstchar == "\xff": # Backward compatiblity: forward data to zmq
@ -111,7 +110,7 @@ class Connection:
try:
if not firstchar: firstchar = sock.recv(1)
except Exception, err:
if self.log: self.log.debug("Socket firstchar error: %s" % Debug.formatException(err))
self.log.debug("Socket firstchar error: %s" % Debug.formatException(err))
self.close()
return False
if firstchar == "\xff": # Backward compatibility to zmq
@ -277,6 +276,7 @@ class Connection:
def close(self):
if self.closed: return False # Already closed
self.closed = True
self.connected = False
self.event_connected.set(False)
if config.debug_socket: self.log.debug("Closing connection, waiting_requests: %s, buff: %s..." % (len(self.waiting_requests), self.incomplete_buff_recv))
@ -296,7 +296,6 @@ class Connection:
if config.debug_socket: self.log.debug("Close error: %s" % Debug.formatException(err))
# Little cleanup
del self.log
del self.unpacker
del self.sock
self.unpacker = None