Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
85bad0b7
Commit
85bad0b7
authored
Aug 27, 2012
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify protocol version
parent
531a7df7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
10 deletions
+6
-10
neo/lib/protocol.py
neo/lib/protocol.py
+6
-10
No files found.
neo/lib/protocol.py
View file @
85bad0b7
...
...
@@ -24,8 +24,7 @@ try:
except
ImportError
:
pass
# The protocol version (major, minor).
PROTOCOL_VERSION
=
(
15
,
1
)
PROTOCOL_VERSION
=
1
# Size restrictions.
MIN_PACKET_SIZE
=
10
...
...
@@ -570,21 +569,18 @@ class PPTID(PStructItem):
value
=
None
return
value
class
PProtocol
(
P
StructItem
):
class
PProtocol
(
P
Number
):
"""
The protocol version definition
"""
def
__init__
(
self
,
name
):
PStructItem
.
__init__
(
self
,
name
,
'!LL'
)
def
_encode
(
self
,
writer
,
version
):
writer
(
self
.
pack
(
*
version
))
writer
(
self
.
pack
(
version
))
def
_decode
(
self
,
reader
):
major
,
minor
=
self
.
unpack
(
reader
(
self
.
size
))
if
(
major
,
minor
)
!=
PROTOCOL_VERSION
:
version
=
self
.
unpack
(
reader
(
self
.
size
))
if
version
!=
(
PROTOCOL_VERSION
,)
:
raise
ProtocolError
(
'protocol version mismatch'
)
return
(
major
,
minor
)
return
version
class
PChecksum
(
PItem
):
"""
...
...
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