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
eda322bb
Commit
eda322bb
authored
10 years ago
by
inso
Browse files
Options
Downloads
Patches
Plain Diff
Fixes to peering again
parent
77de5805
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ucoin/network/peering/peers.py
+10
-12
10 additions, 12 deletions
ucoin/network/peering/peers.py
with
10 additions
and
12 deletions
ucoin/network/peering/peers.py
+
10
−
12
View file @
eda322bb
...
...
@@ -27,7 +27,7 @@ class Base(Network):
class
Stream
(
Base
):
"""
GET a list of peers this node is listening to/by for ANY incoming transaction.
"""
def
__init__
(
self
,
request
,
pgp_fingerprint
,
server
=
None
,
port
=
None
):
def
__init__
(
self
,
request
,
pgp_fingerprint
=
None
,
server
=
None
,
port
=
None
):
"""
Use the pgp fingerprint parameter in order to fit the result.
...
...
@@ -41,11 +41,18 @@ class Stream(Base):
self
.
request
=
request
self
.
pgp_fingerprint
=
pgp_fingerprint
def
__get__
(
self
,
**
kwargs
):
"""
returns the corresponding peer list.
"""
if
self
.
pgp_fingerprint
is
None
:
return
self
.
requests_get
(
'
/%s
'
%
(
self
.
request
),
**
kwargs
).
json
()
else
:
return
self
.
requests_get
(
'
/%s/%s
'
%
(
self
.
request
,
self
.
pgp_fingerprint
),
**
kwargs
).
json
()
class
UpStream
(
Stream
):
"""
GET a list of peers this node is listening to for ANY incoming transaction.
"""
def
__init__
(
self
,
pgp_fingerprint
,
server
=
None
,
port
=
None
):
def
__init__
(
self
,
pgp_fingerprint
=
None
,
server
=
None
,
port
=
None
):
"""
Use the pgp fingerprint parameter in order to fit the result.
...
...
@@ -55,15 +62,11 @@ class UpStream(Stream):
super
().
__init__
(
'
upstream
'
,
pgp_fingerprint
,
server
,
port
)
def
__get__
(
self
,
**
kwargs
):
"""
returns the corresponding peer list.
"""
return
self
.
requests_get
(
'
/%s/%s
'
%
(
self
.
request
,
self
.
pgp_fingerprint
),
**
kwargs
).
json
()
class
DownStream
(
Stream
):
"""
GET a list of peers this node is listening by for ANY incoming transaction.
"""
def
__init__
(
self
,
pgp_fingerprint
,
server
=
None
,
port
=
None
):
def
__init__
(
self
,
pgp_fingerprint
=
None
,
server
=
None
,
port
=
None
):
"""
Use the pgp fingerprint parameter in order to fit the result.
...
...
@@ -72,8 +75,3 @@ class DownStream(Stream):
"""
super
().
__init__
(
'
downstream
'
,
pgp_fingerprint
,
server
,
port
)
def
__get__
(
self
,
**
kwargs
):
"""
returns the corresponding peer list.
"""
return
self
.
requests_get
(
'
/%s/%s
'
%
(
self
.
request
,
self
.
pgp_fingerprint
),
**
kwargs
).
json
()
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