Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sakia
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
clients
python
sakia
Commits
0c3f2c01
Commit
0c3f2c01
authored
9 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Handle gaierror in hope to resolve bug
#273
parent
88eeab68
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/cutecoin/core/net/api/bma/access.py
+4
-7
4 additions, 7 deletions
src/cutecoin/core/net/api/bma/access.py
src/cutecoin/core/net/node.py
+15
-56
15 additions, 56 deletions
src/cutecoin/core/net/node.py
with
19 additions
and
63 deletions
src/cutecoin/core/net/api/bma/access.py
+
4
−
7
View file @
0c3f2c01
...
@@ -7,6 +7,7 @@ import logging
...
@@ -7,6 +7,7 @@ import logging
from
aiohttp.errors
import
ClientError
from
aiohttp.errors
import
ClientError
import
asyncio
import
asyncio
import
random
import
random
from
socket
import
gaierror
import
jsonschema
import
jsonschema
from
distutils.version
import
StrictVersion
from
distutils.version
import
StrictVersion
...
@@ -243,9 +244,7 @@ class BmaAccess(QObject):
...
@@ -243,9 +244,7 @@ class BmaAccess(QObject):
if
'
404
'
in
str
(
e
)
or
'
400
'
in
str
(
e
):
if
'
404
'
in
str
(
e
)
or
'
400
'
in
str
(
e
):
raise
raise
tries
+=
1
tries
+=
1
except
ClientError
:
except
(
ClientError
,
gaierror
,
asyncio
.
TimeoutError
):
tries
+=
1
except
asyncio
.
TimeoutError
:
tries
+=
1
tries
+=
1
except
jsonschema
.
ValidationError
as
e
:
except
jsonschema
.
ValidationError
as
e
:
logging
.
debug
(
str
(
e
))
logging
.
debug
(
str
(
e
))
...
@@ -277,9 +276,7 @@ class BmaAccess(QObject):
...
@@ -277,9 +276,7 @@ class BmaAccess(QObject):
if
'
404
'
in
str
(
e
)
or
'
400
'
in
str
(
e
):
if
'
404
'
in
str
(
e
)
or
'
400
'
in
str
(
e
):
raise
raise
tries
+=
1
tries
+=
1
except
ClientError
:
except
(
ClientError
,
gaierror
,
asyncio
.
TimeoutError
):
tries
+=
1
except
asyncio
.
TimeoutError
:
tries
+=
1
tries
+=
1
except
jsonschema
.
ValidationError
as
e
:
except
jsonschema
.
ValidationError
as
e
:
logging
.
debug
(
str
(
e
))
logging
.
debug
(
str
(
e
))
...
@@ -315,7 +312,7 @@ class BmaAccess(QObject):
...
@@ -315,7 +312,7 @@ class BmaAccess(QObject):
except
ValueError
as
e
:
except
ValueError
as
e
:
if
'
404
'
in
str
(
e
)
or
'
400
'
in
str
(
e
):
if
'
404
'
in
str
(
e
)
or
'
400
'
in
str
(
e
):
raise
raise
except
ClientError
:
except
(
ClientError
,
gaierror
)
:
pass
pass
except
asyncio
.
TimeoutError
:
except
asyncio
.
TimeoutError
:
pass
pass
...
...
This diff is collapsed.
Click to expand it.
src/cutecoin/core/net/node.py
+
15
−
56
View file @
0c3f2c01
...
@@ -15,6 +15,7 @@ from aiohttp.errors import ClientError, DisconnectedError
...
@@ -15,6 +15,7 @@ from aiohttp.errors import ClientError, DisconnectedError
import
logging
import
logging
import
time
import
time
import
jsonschema
import
jsonschema
from
socket
import
gaierror
from
PyQt5.QtCore
import
QObject
,
pyqtSignal
from
PyQt5.QtCore
import
QObject
,
pyqtSignal
...
@@ -316,14 +317,8 @@ class Node(QObject):
...
@@ -316,14 +317,8 @@ class Node(QObject):
logging
.
debug
(
"
Error in previous block reply : {0}
"
.
format
(
self
.
pubkey
))
logging
.
debug
(
"
Error in previous block reply : {0}
"
.
format
(
self
.
pubkey
))
logging
.
debug
(
str
(
e
))
logging
.
debug
(
str
(
e
))
self
.
changed
.
emit
()
self
.
changed
.
emit
()
except
ClientError
:
except
(
ClientError
,
gaierror
,
asyncio
.
TimeoutError
,
DisconnectedError
)
as
e
:
logging
.
debug
(
"
Client error : {0}
"
.
format
(
self
.
pubkey
))
logging
.
debug
(
"
{0} : {1}
"
.
format
(
str
(
e
),
self
.
pubkey
))
self
.
state
=
Node
.
OFFLINE
except
DisconnectedError
:
logging
.
debug
(
"
Disconnected 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
.
state
=
Node
.
OFFLINE
except
jsonschema
.
ValidationError
:
except
jsonschema
.
ValidationError
:
logging
.
debug
(
"
Validation error : {0}
"
.
format
(
self
.
pubkey
))
logging
.
debug
(
"
Validation error : {0}
"
.
format
(
self
.
pubkey
))
...
@@ -342,14 +337,8 @@ class Node(QObject):
...
@@ -342,14 +337,8 @@ class Node(QObject):
logging
.
debug
(
"
Error in block reply : {0}
"
.
format
(
self
.
pubkey
))
logging
.
debug
(
"
Error in block reply : {0}
"
.
format
(
self
.
pubkey
))
logging
.
debug
(
str
(
e
))
logging
.
debug
(
str
(
e
))
self
.
changed
.
emit
()
self
.
changed
.
emit
()
except
ClientError
:
except
(
ClientError
,
gaierror
,
asyncio
.
TimeoutError
,
DisconnectedError
)
as
e
:
logging
.
debug
(
"
Client error : {0}
"
.
format
(
self
.
pubkey
))
logging
.
debug
(
"
{0} : {1}
"
.
format
(
str
(
e
),
self
.
pubkey
))
self
.
state
=
Node
.
OFFLINE
except
DisconnectedError
:
logging
.
debug
(
"
Disconnected 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
.
state
=
Node
.
OFFLINE
except
jsonschema
.
ValidationError
:
except
jsonschema
.
ValidationError
:
logging
.
debug
(
"
Validation error : {0}
"
.
format
(
self
.
pubkey
))
logging
.
debug
(
"
Validation error : {0}
"
.
format
(
self
.
pubkey
))
...
@@ -383,14 +372,8 @@ class Node(QObject):
...
@@ -383,14 +372,8 @@ class Node(QObject):
logging
.
debug
(
"
Error in peering reply : {0}
"
.
format
(
str
(
e
)))
logging
.
debug
(
"
Error in peering reply : {0}
"
.
format
(
str
(
e
)))
self
.
state
=
Node
.
OFFLINE
self
.
state
=
Node
.
OFFLINE
self
.
changed
.
emit
()
self
.
changed
.
emit
()
except
ClientError
:
except
(
ClientError
,
gaierror
,
asyncio
.
TimeoutError
,
DisconnectedError
)
as
e
:
logging
.
debug
(
"
Client error : {0}
"
.
format
(
self
.
pubkey
))
logging
.
debug
(
"
{0} : {1}
"
.
format
(
str
(
e
),
self
.
pubkey
))
self
.
state
=
Node
.
OFFLINE
except
asyncio
.
TimeoutError
:
logging
.
debug
(
"
Timeout error : {0}
"
.
format
(
self
.
pubkey
))
self
.
state
=
Node
.
OFFLINE
except
DisconnectedError
:
logging
.
debug
(
"
Disconnected error : {0}
"
.
format
(
self
.
pubkey
))
self
.
state
=
Node
.
OFFLINE
self
.
state
=
Node
.
OFFLINE
except
jsonschema
.
ValidationError
:
except
jsonschema
.
ValidationError
:
logging
.
debug
(
"
Validation error : {0}
"
.
format
(
self
.
pubkey
))
logging
.
debug
(
"
Validation error : {0}
"
.
format
(
self
.
pubkey
))
...
@@ -417,14 +400,8 @@ class Node(QObject):
...
@@ -417,14 +400,8 @@ class Node(QObject):
logging
.
debug
(
"
Error in summary : {0}
"
.
format
(
e
))
logging
.
debug
(
"
Error in summary : {0}
"
.
format
(
e
))
self
.
state
=
Node
.
OFFLINE
self
.
state
=
Node
.
OFFLINE
self
.
changed
.
emit
()
self
.
changed
.
emit
()
except
ClientError
:
except
(
ClientError
,
gaierror
,
asyncio
.
TimeoutError
,
DisconnectedError
)
as
e
:
logging
.
debug
(
"
Client error : {0}
"
.
format
(
self
.
pubkey
))
logging
.
debug
(
"
{0} : {1}
"
.
format
(
str
(
e
),
self
.
pubkey
))
self
.
state
=
Node
.
OFFLINE
except
asyncio
.
TimeoutError
:
logging
.
debug
(
"
Timeout error : {0}
"
.
format
(
self
.
pubkey
))
self
.
state
=
Node
.
OFFLINE
except
DisconnectedError
:
logging
.
debug
(
"
Disconnected error : {0}
"
.
format
(
self
.
pubkey
))
self
.
state
=
Node
.
OFFLINE
self
.
state
=
Node
.
OFFLINE
except
jsonschema
.
ValidationError
:
except
jsonschema
.
ValidationError
:
logging
.
debug
(
"
Validation error : {0}
"
.
format
(
self
.
pubkey
))
logging
.
debug
(
"
Validation error : {0}
"
.
format
(
self
.
pubkey
))
...
@@ -459,14 +436,8 @@ class Node(QObject):
...
@@ -459,14 +436,8 @@ class Node(QObject):
logging
.
debug
(
"
error in uid reply
"
)
logging
.
debug
(
"
error in uid reply
"
)
self
.
state
=
Node
.
OFFLINE
self
.
state
=
Node
.
OFFLINE
self
.
identity_changed
.
emit
()
self
.
identity_changed
.
emit
()
except
ClientError
:
except
(
ClientError
,
gaierror
,
asyncio
.
TimeoutError
,
DisconnectedError
)
as
e
:
logging
.
debug
(
"
Client error : {0}
"
.
format
(
self
.
pubkey
))
logging
.
debug
(
"
{0} : {1}
"
.
format
(
str
(
e
),
self
.
pubkey
))
self
.
state
=
Node
.
OFFLINE
except
asyncio
.
TimeoutError
:
logging
.
debug
(
"
Timeout error : {0}
"
.
format
(
self
.
pubkey
))
self
.
state
=
Node
.
OFFLINE
except
DisconnectedError
:
logging
.
debug
(
"
Disconnected error : {0}
"
.
format
(
self
.
pubkey
))
self
.
state
=
Node
.
OFFLINE
self
.
state
=
Node
.
OFFLINE
except
jsonschema
.
ValidationError
:
except
jsonschema
.
ValidationError
:
logging
.
debug
(
"
Validation error : {0}
"
.
format
(
self
.
pubkey
))
logging
.
debug
(
"
Validation error : {0}
"
.
format
(
self
.
pubkey
))
...
@@ -500,14 +471,8 @@ class Node(QObject):
...
@@ -500,14 +471,8 @@ class Node(QObject):
logging
.
debug
(
"
Error in leaf reply
"
)
logging
.
debug
(
"
Error in leaf reply
"
)
self
.
state
=
Node
.
OFFLINE
self
.
state
=
Node
.
OFFLINE
self
.
changed
.
emit
()
self
.
changed
.
emit
()
except
ClientError
:
except
(
ClientError
,
gaierror
,
asyncio
.
TimeoutError
,
DisconnectedError
)
as
e
:
logging
.
debug
(
"
Client error : {0}
"
.
format
(
self
.
pubkey
))
logging
.
debug
(
"
{0} : {1}
"
.
format
(
str
(
e
),
self
.
pubkey
))
self
.
state
=
Node
.
OFFLINE
except
asyncio
.
TimeoutError
:
logging
.
debug
(
"
Timeout error : {0}
"
.
format
(
self
.
pubkey
))
self
.
state
=
Node
.
OFFLINE
except
DisconnectedError
:
logging
.
debug
(
"
Disconnected error : {0}
"
.
format
(
self
.
pubkey
))
self
.
state
=
Node
.
OFFLINE
self
.
state
=
Node
.
OFFLINE
except
jsonschema
.
ValidationError
:
except
jsonschema
.
ValidationError
:
logging
.
debug
(
"
Validation error : {0}
"
.
format
(
self
.
pubkey
))
logging
.
debug
(
"
Validation error : {0}
"
.
format
(
self
.
pubkey
))
...
@@ -518,14 +483,8 @@ class Node(QObject):
...
@@ -518,14 +483,8 @@ class Node(QObject):
logging
.
debug
(
"
Error in peers reply
"
)
logging
.
debug
(
"
Error in peers reply
"
)
self
.
state
=
Node
.
OFFLINE
self
.
state
=
Node
.
OFFLINE
self
.
changed
.
emit
()
self
.
changed
.
emit
()
except
ClientError
:
except
(
ClientError
,
gaierror
,
asyncio
.
TimeoutError
,
DisconnectedError
)
as
e
:
logging
.
debug
(
"
Client error : {0}
"
.
format
(
self
.
pubkey
))
logging
.
debug
(
"
{0} : {1}
"
.
format
(
str
(
e
),
self
.
pubkey
))
self
.
state
=
Node
.
OFFLINE
except
asyncio
.
TimeoutError
:
logging
.
debug
(
"
Timeout error : {0}
"
.
format
(
self
.
pubkey
))
self
.
state
=
Node
.
OFFLINE
except
DisconnectedError
:
logging
.
debug
(
"
Disconnected error : {0}
"
.
format
(
self
.
pubkey
))
self
.
state
=
Node
.
OFFLINE
self
.
state
=
Node
.
OFFLINE
except
jsonschema
.
ValidationError
:
except
jsonschema
.
ValidationError
:
logging
.
debug
(
"
Validation error : {0}
"
.
format
(
self
.
pubkey
))
logging
.
debug
(
"
Validation error : {0}
"
.
format
(
self
.
pubkey
))
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment