Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ivan Tyagov
neoppod
Commits
7d6b9c87
Commit
7d6b9c87
authored
Sep 14, 2011
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
neoctl: fix 'print node' command to get list of all nodes
Protocol is extended to allow passing None in an Enum field.
parent
759491bd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
6 deletions
+14
-6
neo/admin/handler.py
neo/admin/handler.py
+6
-3
neo/lib/protocol.py
neo/lib/protocol.py
+8
-3
No files found.
neo/admin/handler.py
View file @
7d6b9c87
...
...
@@ -61,9 +61,12 @@ class AdminEventHandler(EventHandler):
def
askNodeList
(
self
,
conn
,
node_type
):
neo
.
lib
.
logging
.
info
(
"ask node list for %s"
%
(
node_type
))
def
node_filter
(
n
):
return
n
.
getType
()
is
node_type
if
node_type
is
None
:
node_type
=
'all'
node_filter
=
None
else
:
node_filter
=
lambda
n
:
n
.
getType
()
is
node_type
neo
.
lib
.
logging
.
info
(
"ask list of %s nodes"
,
node_type
)
node_list
=
self
.
app
.
nm
.
getList
(
node_filter
)
node_information_list
=
[
node
.
asTuple
()
for
node
in
node_list
]
p
=
Packets
.
AnswerNodeList
(
node_information_list
)
...
...
neo/lib/protocol.py
View file @
7d6b9c87
...
...
@@ -281,7 +281,7 @@ class PItem(object):
def
decode
(
self
,
reader
):
return
self
.
_trace
(
self
.
_decode
,
reader
)
def
_encode
(
self
,
writer
):
def
_encode
(
self
,
writer
,
items
):
raise
NotImplementedError
,
self
.
__class__
.
__name__
def
_decode
(
self
,
reader
):
...
...
@@ -372,15 +372,20 @@ class PEnum(PStructItem):
Encapsulate an enumeration value
"""
def
__init__
(
self
,
name
,
enum
):
PStructItem
.
__init__
(
self
,
name
,
'!
L
'
)
PStructItem
.
__init__
(
self
,
name
,
'!
l
'
)
self
.
_enum
=
enum
def
_encode
(
self
,
writer
,
item
):
assert
isinstance
(
item
,
int
),
item
if
item
is
None
:
item
=
-
1
else
:
assert
isinstance
(
item
,
int
),
item
writer
(
self
.
pack
(
item
))
def
_decode
(
self
,
reader
):
code
=
self
.
unpack
(
reader
(
self
.
size
))[
0
]
if
code
==
-
1
:
return
None
try
:
return
self
.
_enum
[
code
]
except
KeyError
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment