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
a89b532e
Commit
a89b532e
authored
9 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Fix errors due to bad connection quality
parent
a936dec2
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/cutecoin/core/net/node.py
+23
-2
23 additions, 2 deletions
src/cutecoin/core/net/node.py
src/cutecoin/gui/process_cfg_community.py
+7
-4
7 additions, 4 deletions
src/cutecoin/gui/process_cfg_community.py
src/cutecoin/main.py
+2
-1
2 additions, 1 deletion
src/cutecoin/main.py
with
32 additions
and
7 deletions
src/cutecoin/core/net/node.py
+
23
−
2
View file @
a89b532e
...
@@ -11,7 +11,7 @@ from ucoinpy.api import bma as bma
...
@@ -11,7 +11,7 @@ from ucoinpy.api import bma as bma
from
ucoinpy.api.bma
import
ConnectionHandler
from
ucoinpy.api.bma
import
ConnectionHandler
import
asyncio
import
asyncio
from
aiohttp.errors
import
ClientError
from
aiohttp.errors
import
ClientError
,
DisconnectedError
import
logging
import
logging
import
time
import
time
import
jsonschema
import
jsonschema
...
@@ -21,7 +21,7 @@ from PyQt5.QtCore import QObject, pyqtSignal
...
@@ -21,7 +21,7 @@ from PyQt5.QtCore import QObject, pyqtSignal
class
Node
(
QObject
):
class
Node
(
QObject
):
"""
"""
A node is a peer se
e
nd from the client point of view.
A node is a peer send from the client point of view.
This node can have multiple states :
This node can have multiple states :
- ONLINE : The node is available for requests
- ONLINE : The node is available for requests
- OFFLINE: The node is disconnected
- OFFLINE: The node is disconnected
...
@@ -317,6 +317,9 @@ class Node(QObject):
...
@@ -317,6 +317,9 @@ class Node(QObject):
except
ClientError
:
except
ClientError
:
logging
.
debug
(
"
Client error : {0}
"
.
format
(
self
.
pubkey
))
logging
.
debug
(
"
Client error : {0}
"
.
format
(
self
.
pubkey
))
self
.
state
=
Node
.
OFFLINE
self
.
state
=
Node
.
OFFLINE
except
DisconnectedError
:
logging
.
debug
(
"
Disconnected error : {0}
"
.
format
(
self
.
pubkey
))
self
.
state
=
Node
.
OFFLINE
except
asyncio
.
TimeoutError
:
except
asyncio
.
TimeoutError
:
logging
.
debug
(
"
Timeout error : {0}
"
.
format
(
self
.
pubkey
))
logging
.
debug
(
"
Timeout error : {0}
"
.
format
(
self
.
pubkey
))
self
.
state
=
Node
.
OFFLINE
self
.
state
=
Node
.
OFFLINE
...
@@ -338,6 +341,9 @@ class Node(QObject):
...
@@ -338,6 +341,9 @@ class Node(QObject):
except
ClientError
:
except
ClientError
:
logging
.
debug
(
"
Client error : {0}
"
.
format
(
self
.
pubkey
))
logging
.
debug
(
"
Client error : {0}
"
.
format
(
self
.
pubkey
))
self
.
state
=
Node
.
OFFLINE
self
.
state
=
Node
.
OFFLINE
except
DisconnectedError
:
logging
.
debug
(
"
Disconnected error : {0}
"
.
format
(
self
.
pubkey
))
self
.
state
=
Node
.
OFFLINE
except
asyncio
.
TimeoutError
:
except
asyncio
.
TimeoutError
:
logging
.
debug
(
"
Timeout error : {0}
"
.
format
(
self
.
pubkey
))
logging
.
debug
(
"
Timeout error : {0}
"
.
format
(
self
.
pubkey
))
self
.
state
=
Node
.
OFFLINE
self
.
state
=
Node
.
OFFLINE
...
@@ -375,6 +381,9 @@ class Node(QObject):
...
@@ -375,6 +381,9 @@ class Node(QObject):
except
asyncio
.
TimeoutError
:
except
asyncio
.
TimeoutError
:
logging
.
debug
(
"
Timeout error : {0}
"
.
format
(
self
.
pubkey
))
logging
.
debug
(
"
Timeout error : {0}
"
.
format
(
self
.
pubkey
))
self
.
state
=
Node
.
OFFLINE
self
.
state
=
Node
.
OFFLINE
except
DisconnectedError
:
logging
.
debug
(
"
Disconnected error : {0}
"
.
format
(
self
.
pubkey
))
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
))
self
.
state
=
Node
.
CORRUPTED
self
.
state
=
Node
.
CORRUPTED
...
@@ -405,6 +414,9 @@ class Node(QObject):
...
@@ -405,6 +414,9 @@ class Node(QObject):
except
asyncio
.
TimeoutError
:
except
asyncio
.
TimeoutError
:
logging
.
debug
(
"
Timeout error : {0}
"
.
format
(
self
.
pubkey
))
logging
.
debug
(
"
Timeout error : {0}
"
.
format
(
self
.
pubkey
))
self
.
state
=
Node
.
OFFLINE
self
.
state
=
Node
.
OFFLINE
except
DisconnectedError
:
logging
.
debug
(
"
Disconnected error : {0}
"
.
format
(
self
.
pubkey
))
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
))
self
.
state
=
Node
.
CORRUPTED
self
.
state
=
Node
.
CORRUPTED
...
@@ -443,6 +455,9 @@ class Node(QObject):
...
@@ -443,6 +455,9 @@ class Node(QObject):
except
asyncio
.
TimeoutError
:
except
asyncio
.
TimeoutError
:
logging
.
debug
(
"
Timeout error : {0}
"
.
format
(
self
.
pubkey
))
logging
.
debug
(
"
Timeout error : {0}
"
.
format
(
self
.
pubkey
))
self
.
state
=
Node
.
OFFLINE
self
.
state
=
Node
.
OFFLINE
except
DisconnectedError
:
logging
.
debug
(
"
Disconnected error : {0}
"
.
format
(
self
.
pubkey
))
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
))
self
.
state
=
Node
.
CORRUPTED
self
.
state
=
Node
.
CORRUPTED
...
@@ -480,6 +495,9 @@ class Node(QObject):
...
@@ -480,6 +495,9 @@ class Node(QObject):
except
asyncio
.
TimeoutError
:
except
asyncio
.
TimeoutError
:
logging
.
debug
(
"
Timeout error : {0}
"
.
format
(
self
.
pubkey
))
logging
.
debug
(
"
Timeout error : {0}
"
.
format
(
self
.
pubkey
))
self
.
state
=
Node
.
OFFLINE
self
.
state
=
Node
.
OFFLINE
except
DisconnectedError
:
logging
.
debug
(
"
Disconnected error : {0}
"
.
format
(
self
.
pubkey
))
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
))
self
.
state
=
Node
.
CORRUPTED
self
.
state
=
Node
.
CORRUPTED
...
@@ -494,6 +512,9 @@ class Node(QObject):
...
@@ -494,6 +512,9 @@ class Node(QObject):
except
asyncio
.
TimeoutError
:
except
asyncio
.
TimeoutError
:
logging
.
debug
(
"
Timeout error : {0}
"
.
format
(
self
.
pubkey
))
logging
.
debug
(
"
Timeout error : {0}
"
.
format
(
self
.
pubkey
))
self
.
state
=
Node
.
OFFLINE
self
.
state
=
Node
.
OFFLINE
except
DisconnectedError
:
logging
.
debug
(
"
Disconnected error : {0}
"
.
format
(
self
.
pubkey
))
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
))
self
.
state
=
Node
.
CORRUPTED
self
.
state
=
Node
.
CORRUPTED
...
...
This diff is collapsed.
Click to expand it.
src/cutecoin/gui/process_cfg_community.py
+
7
−
4
View file @
a89b532e
...
@@ -6,6 +6,7 @@ Created on 8 mars 2014
...
@@ -6,6 +6,7 @@ Created on 8 mars 2014
import
logging
import
logging
import
asyncio
import
asyncio
import
aiohttp
from
PyQt5.QtWidgets
import
QDialog
,
QMenu
,
QMessageBox
,
QApplication
from
PyQt5.QtWidgets
import
QDialog
,
QMenu
,
QMessageBox
,
QApplication
from
PyQt5.QtGui
import
QCursor
from
PyQt5.QtGui
import
QCursor
...
@@ -88,8 +89,8 @@ Yours : {0}, the network : {1}""".format(registered[1], registered[2])))
...
@@ -88,8 +89,8 @@ Yours : {0}, the network : {1}""".format(registered[1], registered[2])))
server
=
self
.
config_dialog
.
lineedit_server
.
text
()
server
=
self
.
config_dialog
.
lineedit_server
.
text
()
port
=
self
.
config_dialog
.
spinbox_port
.
value
()
port
=
self
.
config_dialog
.
spinbox_port
.
value
()
logging
.
debug
(
"
Is valid ?
"
)
logging
.
debug
(
"
Is valid ?
"
)
try
:
self
.
node
=
yield
from
Node
.
from_address
(
None
,
server
,
port
)
self
.
node
=
yield
from
Node
.
from_address
(
None
,
server
,
port
)
if
self
.
node
:
community
=
Community
.
create
(
self
.
node
)
community
=
Community
.
create
(
self
.
node
)
self
.
config_dialog
.
button_connect
.
setEnabled
(
False
)
self
.
config_dialog
.
button_connect
.
setEnabled
(
False
)
self
.
config_dialog
.
button_register
.
setEnabled
(
False
)
self
.
config_dialog
.
button_register
.
setEnabled
(
False
)
...
@@ -119,8 +120,10 @@ Yours : {0}, the network : {1}""".format(registered[1], registered[2])))
...
@@ -119,8 +120,10 @@ Yours : {0}, the network : {1}""".format(registered[1], registered[2])))
Yours : {0}, the network : {1}
"""
.
format
(
registered
[
1
],
registered
[
2
])))
Yours : {0}, the network : {1}
"""
.
format
(
registered
[
1
],
registered
[
2
])))
else
:
else
:
self
.
config_dialog
.
label_error
.
setText
(
self
.
tr
(
"
Your account already exists on the network
"
))
self
.
config_dialog
.
label_error
.
setText
(
self
.
tr
(
"
Your account already exists on the network
"
))
else
:
except
aiohttp
.
errors
.
DisconnectedError
as
e
:
self
.
config_dialog
.
label_error
.
setText
(
self
.
tr
(
"
Could not connect.
"
))
self
.
config_dialog
.
label_error
.
setText
(
str
(
e
))
except
aiohttp
.
errors
.
ClientError
as
e
:
self
.
config_dialog
.
label_error
.
setText
(
str
(
e
))
@pyqtSlot
()
@pyqtSlot
()
def
check_register
(
self
):
def
check_register
(
self
):
...
...
This diff is collapsed.
Click to expand it.
src/cutecoin/main.py
+
2
−
1
View file @
a89b532e
...
@@ -41,7 +41,8 @@ def async_exception_handler(loop, context):
...
@@ -41,7 +41,8 @@ def async_exception_handler(loop, context):
log_lines
.
append
(
'
{}: {!r}
'
.
format
(
key
,
context
[
key
]))
log_lines
.
append
(
'
{}: {!r}
'
.
format
(
key
,
context
[
key
]))
logging
.
error
(
'
\n
'
.
join
(
log_lines
),
exc_info
=
exc_info
)
logging
.
error
(
'
\n
'
.
join
(
log_lines
),
exc_info
=
exc_info
)
if
"
Unclosed
"
not
in
message
:
if
"
Unclosed
"
not
in
message
and
\
"
gaierror(-2
"
not
in
message
:
os
.
_exit
(
1
)
os
.
_exit
(
1
)
...
...
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