Skip to content

Commit

Permalink
Lower timeout for nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
hoffmabc committed Sep 6, 2014
1 parent fbe24af commit c2ba6fc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
11 changes: 7 additions & 4 deletions node/crypto2crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,17 @@ def generate_sin(self, guid):
def check_port(self):
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.settimeout(5)
s.settimeout(1)
s.connect((self._ip, self._port))
except socket.error:
try:
s = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
s.settimeout(5)
s.settimeout(1)
s.connect((self._ip, self._port))
except socket.error as e:
self._log.error("socket error on %s: %s" % (self._ip, e))
self._transport._dht.remove_active_peer(self._address)
#self._transport._dht._routingTable.removeContact(self._guid)
return False
except TypeError:
self._log.error("tried connecting to invalid address: %s" % self._ip)
Expand Down Expand Up @@ -159,8 +161,8 @@ def send(self, data, callback=lambda msg: None):
self._log.error('Cannot reach this peer to send raw')
else:
self._log.error('Data was empty')
except Exception:
self._log.error("Was not able to encode empty data: %e")
except Exception as e:
self._log.error("Was not able to encode empty data: %s" % e)
else:
self._log.error('Cannot send to peer')

Expand Down Expand Up @@ -535,6 +537,7 @@ def addCryptoPeer(self, peer_to_add):

# Update existing peer
self._activePeers[idx] = peer_to_add
self._dht.add_peer(self, peer_to_add._address, peer_to_add._pub, peer_to_add._guid, peer_to_add._nickname)

if not foundOutdatedPeer and peer_to_add._guid != self._guid:
self._log.info('Adding crypto peer at %s' % peer_to_add._nickname)
Expand Down
3 changes: 2 additions & 1 deletion node/market.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ def shipping_address(self):
def add_trusted_notary(self, guid, nickname=""):
self._log.debug('%s %s' % (guid, nickname))
notaries = self.settings.get('notaries')
self._log.debug('notaries: %s' % notaries)
if notaries == "" or notaries == []:
notaries = []
else:
Expand Down Expand Up @@ -346,7 +347,7 @@ def remove_contract(self, msg):
self.update_listings_index()

def remove_from_keyword_indexes(self, contract_id):
contract = self._db.selectEntries("contracts", "id = '%s'" % contract_id.replace("'", "''"))[0]
contract = self._db.selectEntries("contracts", "id = '%s'" % contract_id)[0]
contract_key = contract['key']

contract = json.loads(contract['contract_body'])
Expand Down

0 comments on commit c2ba6fc

Please sign in to comment.