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
655906f5
Commit
655906f5
authored
Jan 12, 2021
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
bf824e6c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
13 deletions
+3
-13
go/neo/neonet/connection.go
go/neo/neonet/connection.go
+0
-2
go/neo/neonet/connection_test.go
go/neo/neonet/connection_test.go
+3
-11
No files found.
go/neo/neonet/connection.go
View file @
655906f5
...
@@ -1533,7 +1533,6 @@ func (c *Conn) Recv() (proto.Msg, error) {
...
@@ -1533,7 +1533,6 @@ func (c *Conn) Recv() (proto.Msg, error) {
func
(
link
*
NodeLink
)
sendMsg
(
connId
uint32
,
msg
proto
.
Msg
)
error
{
func
(
link
*
NodeLink
)
sendMsg
(
connId
uint32
,
msg
proto
.
Msg
)
error
{
traceMsgSendPre
(
link
,
connId
,
msg
)
traceMsgSendPre
(
link
,
connId
,
msg
)
//buf := msgPack(connId, msg)
buf
:=
pktEncode
(
link
.
enc
,
connId
,
msg
)
buf
:=
pktEncode
(
link
.
enc
,
connId
,
msg
)
return
link
.
sendPkt
(
buf
)
// XXX more context in err? (msg type)
return
link
.
sendPkt
(
buf
)
// XXX more context in err? (msg type)
// FIXME ^^^ shutdown whole link on error
// FIXME ^^^ shutdown whole link on error
...
@@ -1543,7 +1542,6 @@ func (link *NodeLink) sendMsg(connId uint32, msg proto.Msg) error {
...
@@ -1543,7 +1542,6 @@ func (link *NodeLink) sendMsg(connId uint32, msg proto.Msg) error {
func
(
c
*
Conn
)
Send
(
msg
proto
.
Msg
)
error
{
func
(
c
*
Conn
)
Send
(
msg
proto
.
Msg
)
error
{
traceMsgSendPre
(
c
.
link
,
c
.
connId
,
msg
)
traceMsgSendPre
(
c
.
link
,
c
.
connId
,
msg
)
//buf := msgPack(c.connId, msg)
buf
:=
pktEncode
(
c
.
link
.
enc
,
c
.
connId
,
msg
)
buf
:=
pktEncode
(
c
.
link
.
enc
,
c
.
connId
,
msg
)
return
c
.
sendPkt
(
buf
)
// XXX more context in err? (msg type)
return
c
.
sendPkt
(
buf
)
// XXX more context in err? (msg type)
}
}
...
...
go/neo/neonet/connection_test.go
View file @
655906f5
...
@@ -51,7 +51,7 @@ type T struct {
...
@@ -51,7 +51,7 @@ type T struct {
enc
proto
.
Encoding
// encoding to use for messages exchange
enc
proto
.
Encoding
// encoding to use for messages exchange
}
}
// bin returns payload for raw binary data as would-be encoded by t.enc .
// bin returns payload for raw binary data as
it
would-be encoded by t.enc .
// XXX place
// XXX place
func
(
t
*
T
)
bin
(
data
string
)
[]
byte
{
func
(
t
*
T
)
bin
(
data
string
)
[]
byte
{
switch
t
.
enc
{
switch
t
.
enc
{
...
@@ -149,11 +149,8 @@ func _mkpkt(enc proto.Encoding, connid uint32, msgcode uint16, payload []byte) *
...
@@ -149,11 +149,8 @@ func _mkpkt(enc proto.Encoding, connid uint32, msgcode uint16, payload []byte) *
b
=
msgp
.
AppendArrayHeader
(
b
,
3
)
b
=
msgp
.
AppendArrayHeader
(
b
,
3
)
b
=
msgp
.
AppendUint32
(
b
,
connid
)
b
=
msgp
.
AppendUint32
(
b
,
connid
)
b
=
msgp
.
AppendUint16
(
b
,
msgcode
)
b
=
msgp
.
AppendUint16
(
b
,
msgcode
)
// // NOTE payload is appended wrapped into bin object. We need
// NOTE payload is assumed to be valid msgpack-encoded object.
// // this not to break framing, because in M-encoding whole
b
=
append
(
b
,
payload
...
)
// // packet must be a valid msgpack object.
// b = msgp.AppendBytes (b, payload)
b
=
append
(
b
,
payload
...
)
return
&
pktBuf
{
b
}
return
&
pktBuf
{
b
}
default
:
default
:
...
@@ -180,11 +177,6 @@ func (t *T) xverifyPkt(pkt *pktBuf, connid uint32, msgcode uint16, payload []byt
...
@@ -180,11 +177,6 @@ func (t *T) xverifyPkt(pkt *pktBuf, connid uint32, msgcode uint16, payload []byt
if
pktMsgCode
!=
msgcode
{
if
pktMsgCode
!=
msgcode
{
errv
.
Appendf
(
"header: unexpected msgcode %v (want %v)"
,
pktMsgCode
,
msgcode
)
errv
.
Appendf
(
"header: unexpected msgcode %v (want %v)"
,
pktMsgCode
,
msgcode
)
}
}
// // M-encoding -> wrap payloadOK into bin (see _mkpkt ^^^ for why)
// if t.enc == 'M' {
// payload = msgp.AppendBytes(nil, payload)
// }
if
!
bytes
.
Equal
(
pktPayload
,
payload
)
{
if
!
bytes
.
Equal
(
pktPayload
,
payload
)
{
errv
.
Appendf
(
"payload differ:
\n
%s"
,
errv
.
Appendf
(
"payload differ:
\n
%s"
,
pretty
.
Compare
(
string
(
payload
),
string
(
pktPayload
)))
pretty
.
Compare
(
string
(
payload
),
string
(
pktPayload
)))
...
...
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