Skip to content
Snippets Groups Projects
Commit 576870e5 authored by inso's avatar inso
Browse files

Merge branch 'dev' of https://github.com/ucoin-io/cutecoin into dev

parents 7468820d 56a7a8e6
No related branches found
No related tags found
No related merge requests found
...@@ -169,12 +169,13 @@ class BmaAccess(QObject): ...@@ -169,12 +169,13 @@ class BmaAccess(QObject):
tries += 1 tries += 1
except ClientError: except ClientError:
tries += 1 tries += 1
except TimeoutError: except asyncio.TimeoutError:
tries += 1 tries += 1
if len(nodes) == 0 or json_data is None: if len(nodes) == 0 or json_data is None:
raise NoPeerAvailable("", len(nodes)) raise NoPeerAvailable("", len(nodes))
return json_data return json_data
@asyncio.coroutine
def simple_request(self, request, req_args={}, get_args={}): def simple_request(self, request, req_args={}, get_args={}):
""" """
Start a request to the network but don't cache its result. Start a request to the network but don't cache its result.
...@@ -199,11 +200,12 @@ class BmaAccess(QObject): ...@@ -199,11 +200,12 @@ class BmaAccess(QObject):
tries += 1 tries += 1
except ClientError: except ClientError:
tries += 1 tries += 1
except TimeoutError: except asyncio.TimeoutError:
tries += 1 tries += 1
else: else:
raise NoPeerAvailable("", len(nodes)) raise NoPeerAvailable("", len(nodes))
@asyncio.coroutine
def broadcast(self, request, req_args={}, post_args={}): def broadcast(self, request, req_args={}, post_args={}):
""" """
Broadcast data to a network. Broadcast data to a network.
...@@ -233,7 +235,7 @@ class BmaAccess(QObject): ...@@ -233,7 +235,7 @@ class BmaAccess(QObject):
raise raise
except ClientError: except ClientError:
pass pass
except TimeoutError: except asyncio.TimeoutError:
pass pass
else: else:
raise NoPeerAvailable("", len(nodes)) raise NoPeerAvailable("", len(nodes))
......
...@@ -442,6 +442,12 @@ class Node(QObject): ...@@ -442,6 +442,12 @@ class Node(QObject):
except ValueError as e: except ValueError as e:
logging.debug("Error in leaf reply") logging.debug("Error in leaf reply")
self.changed.emit() self.changed.emit()
except ClientError:
logging.debug("Client error : {0}".format(self.pubkey))
self.state = Node.OFFLINE
except asyncio.TimeoutError:
logging.debug("Timeout error : {0}".format(self.pubkey))
self.state = Node.OFFLINE
self._last_merkle = {'root' : peers_data['root'], self._last_merkle = {'root' : peers_data['root'],
'leaves': peers_data['leaves']} 'leaves': peers_data['leaves']}
except ValueError as e: except ValueError as e:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment