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
Levin Zimmermann
neoppod
Commits
c643ba53
Commit
c643ba53
authored
Sep 14, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X Send1: switch to sending directly over link
parent
d39a6fc3
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
7 deletions
+13
-7
go/neo/connection.go
go/neo/connection.go
+13
-7
No files found.
go/neo/connection.go
View file @
c643ba53
...
...
@@ -302,7 +302,7 @@ func (nl *NodeLink) NewConn() (*Conn, error) {
return
c
,
nil
}
// shutdownAX marks acceptq as no longer operational
// shutdownAX marks acceptq as no longer operational
and interrupts Accept.
func
(
link
*
NodeLink
)
shutdownAX
()
{
link
.
axdown1
.
Do
(
func
()
{
close
(
link
.
axdown
)
...
...
@@ -364,12 +364,12 @@ func (nl *NodeLink) shutdown() {
})
}
// CloseAccept instructs node link to not accept incoming conections anymore.
// CloseAccept instructs node link to not accept incoming con
n
ections anymore.
//
// Any blocked Accept() will be unblocked and return error.
// The peer will receive "connection refused" if it tries to connect after.
//
// It is safe
t
to call CloseAccept several times.
// It is safe to call CloseAccept several times.
func
(
link
*
NodeLink
)
CloseAccept
()
{
link
.
axclosed
.
Set
(
1
)
link
.
shutdownAX
()
...
...
@@ -395,6 +395,7 @@ func (c *Conn) shutdown() {
c
.
shutdownRX
(
errConnClosed
)
}
// shutdownTX marks TX as no longer operational (?) and interrupts Send.
func
(
c
*
Conn
)
shutdownTX
()
{
c
.
txdownOnce
.
Do
(
func
()
{
close
(
c
.
txdown
)
...
...
@@ -1335,12 +1336,13 @@ func (c *Conn) Recv() (Msg, error) {
//
// it encodes message int packet, sets header appropriately and sends it.
//
// it is ok to call sendMsg in parallel with serveSend
running XXX why
// it is ok to call sendMsg in parallel with serveSend
. XXX link to sendPktDirect for rationale?
func
(
link
*
NodeLink
)
sendMsg
(
connId
uint32
,
msg
Msg
)
error
{
traceMsgSendPre
(
link
,
connId
,
msg
)
buf
:=
msgPack
(
connId
,
msg
)
return
link
.
sendPkt
(
buf
)
// XXX more context in err? (msg type)
// FIXME ^^^ shutdown whole link on error
}
// Send sends message.
...
...
@@ -1353,6 +1355,10 @@ func (c *Conn) Send(msg Msg) error {
return
c
.
sendPkt
(
buf
)
// XXX more context in err? (msg type)
}
func
(
c
*
Conn
)
sendMsgDirect
(
msg
Msg
)
error
{
return
c
.
link
.
sendMsg
(
c
.
connId
,
msg
)
}
// Expect receives message and checks it is one of expected types
//
...
...
@@ -1497,9 +1503,9 @@ func (link *NodeLink) Send1(msg Msg) error {
return
err
}
conn
.
downRX
(
errConnClosed
)
// FIXME
just new conn this way
conn
.
downRX
(
errConnClosed
)
// XXX
just new conn this way
err
=
conn
.
Send
(
msg
)
err
=
conn
.
sendMsgDirect
(
msg
)
conn
.
lightClose
()
return
err
}
...
...
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