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
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
Stefane Fermigier
neo
Commits
3d0666ab
Commit
3d0666ab
authored
Apr 28, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
235c7466
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
13 deletions
+12
-13
go/neo/connection.go
go/neo/connection.go
+2
-2
go/neo/connection_test.go
go/neo/connection_test.go
+10
-11
No files found.
go/neo/connection.go
View file @
3d0666ab
...
...
@@ -307,7 +307,7 @@ func (nl *NodeLink) serveRecv() {
for
{
// receive 1 packet
pkt
,
err
:=
nl
.
recvPkt
()
fmt
.
Printf
(
"recvPkt -> %v, %v
\n
"
,
pkt
,
err
)
//
fmt.Printf("recvPkt -> %v, %v\n", pkt, err)
if
err
!=
nil
{
// on IO error framing over peerLink becomes broken
// so we mark node link and all connections as closed and stop service
...
...
@@ -444,7 +444,7 @@ func (nl *NodeLink) serveSend() {
case
txreq
:=
<-
nl
.
txq
:
err
:=
nl
.
sendPkt
(
txreq
.
pkt
)
fmt
.
Printf
(
"sendPkt -> %v
\n
"
,
err
)
//
fmt.Printf("sendPkt -> %v\n", err)
// on IO error framing over peerLink becomes broken
// so mark node link and all connections as closed and stop service
...
...
go/neo/connection_test.go
View file @
3d0666ab
...
...
@@ -158,7 +158,6 @@ func nodeLinkPipe() (nl1, nl2 *NodeLink) {
func
TestNodeLink
(
t
*
testing
.
T
)
{
// TODO catch exception -> add proper location from it -> t.Fatal (see git-backup)
/*
// Close vs recvPkt
nl1
,
nl2
:=
_nodeLinkPipe
(
linkNoRecvSend
,
linkNoRecvSend
)
wg
:=
WorkGroup
()
...
...
@@ -306,14 +305,14 @@ func TestNodeLink(t *testing.T) {
wg
=
WorkGroup
()
wg
.
Gox
(
func
()
{
pkt
,
err
:=
c11
.
Recv
()
if !(pkt == nil && err == Err
ClosedConn
) {
if
!
(
pkt
==
nil
&&
err
==
Err
LinkClosed
)
{
exc
.
Raisef
(
"Conn.Recv() after NodeLink close: pkt = %v err = %v"
,
pkt
,
err
)
}
})
wg
.
Gox
(
func
()
{
pkt
:=
&
PktBuf
{[]
byte
(
"data"
)}
err
:=
c12
.
Send
(
pkt
)
if err != Err
ClosedConn
{
if
err
!=
Err
LinkClosed
{
exc
.
Raisef
(
"Conn.Send() after NodeLink close: err = %v"
,
err
)
}
})
...
...
@@ -323,14 +322,13 @@ func TestNodeLink(t *testing.T) {
xclose
(
c11
)
xclose
(
c12
)
xclose
(
nl2
)
*/
// NodeLink.Close vs Conn.Send/Recv on another side
nl1
,
nl2
:
=
_nodeLinkPipe
(
0
,
linkNoRecvSend
)
c11
:
=
nl1
.
NewConn
()
c12
:
=
nl1
.
NewConn
()
nl1
,
nl2
=
_nodeLinkPipe
(
0
,
linkNoRecvSend
)
c11
=
nl1
.
NewConn
()
c12
=
nl1
.
NewConn
()
c13
:=
nl1
.
NewConn
()
wg
:
=
WorkGroup
()
wg
=
WorkGroup
()
var
errRecv
error
wg
.
Gox
(
func
()
{
pkt
,
err
:=
c11
.
Recv
()
...
...
@@ -355,8 +353,10 @@ func TestNodeLink(t *testing.T) {
xclose
(
nl2
)
xwait
(
wg
)
// XXX denoise vvv
// Recv/Send on another Conn
pkt
,
err
:
=
c13
.
Recv
()
pkt
,
err
=
c13
.
Recv
()
if
!
(
pkt
==
nil
&&
err
==
errRecv
)
{
t
.
Fatalf
(
"Conn.Recv 2 after peer NodeLink shutdown: pkt = %v err = %v"
,
pkt
,
err
)
}
...
...
@@ -409,7 +409,7 @@ func TestNodeLink(t *testing.T) {
t
.
Fatalf
(
"Conn.Send after close and NodeLink close: %v"
,
err
)
}
/*
// Conn accept + exchange
nl1
,
nl2
=
nodeLinkPipe
()
wg
=
WorkGroup
()
...
...
@@ -495,5 +495,4 @@ func TestNodeLink(t *testing.T) {
xclose
(
c2
)
xclose
(
nl1
)
xclose
(
nl2
)
*/
}
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