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
7dcbc9c5
Commit
7dcbc9c5
authored
Sep 14, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X Send1: switch to lightClose
parent
dba74d2d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
26 deletions
+20
-26
go/neo/connection.go
go/neo/connection.go
+20
-26
No files found.
go/neo/connection.go
View file @
7dcbc9c5
...
...
@@ -229,15 +229,13 @@ func (c *Conn) release() {
// reinit reinitializes connection after reallocating it from freelist
func
(
c
*
Conn
)
reinit
()
{
// .link - already set XXX set =nil ?
// .connId - already set XXX set =0 ?
// .rxq - set initially; does not change
c
.
link
=
nil
c
.
connId
=
0
// .rxq - set initially; does not change
c
.
rxqActive
.
Set
(
0
)
// XXX store relaxed?
c
.
rxdownFlag
.
Set
(
0
)
// ----//----
c
.
rxerrOnce
=
sync
.
Once
{}
// XXX ok?
// c.errMsg = nil // XXX what here?
// XXX vvv not strictly needed for light mode?
...
...
@@ -310,7 +308,7 @@ func (link *NodeLink) shutdownAX() {
close
(
link
.
axdown
)
// dequeue all connections already queued in link.acceptq
// (once serveRecv
s
sees link.axdown it won't try to put new connections into
// (once serveRecv sees link.axdown it won't try to put new connections into
// link.acceptq, but something finite could be already there)
loop
:
for
{
...
...
@@ -413,7 +411,6 @@ func (c *Conn) shutdownRX(errMsg *Error) {
// downRX marks .rxq as no longer operational.
func
(
c
*
Conn
)
downRX
(
errMsg
*
Error
)
{
// c.errMsg = errMsg
c
.
rxdownFlag
.
Set
(
1
)
// XXX cmpxchg and return if already down?
// dequeue all packets already queued in c.rxq
...
...
@@ -445,23 +442,6 @@ loop:
// "connection closed" if a packet comes in with same connID.
var
connKeepClosed
=
1
*
time
.
Minute
// lightClose closes light connection.
//
// No Send or Recv must be in flight.
// The caller must not use c after call to close - the connection is returned to freelist.
func
(
c
*
Conn
)
lightClose
()
{
nl
:=
c
.
link
nl
.
connMu
.
Lock
()
if
nl
.
connTab
!=
nil
{
// XXX find way to keep initiated by us conn as closed for some time (see Conn.Close)
// but timer costs too much...
delete
(
nl
.
connTab
,
c
.
connId
)
}
nl
.
connMu
.
Unlock
()
c
.
release
()
}
// CloseRecv closes reading end of connection.
//
// Any blocked Recv*() will be unblocked and return error.
...
...
@@ -1451,7 +1431,22 @@ func (c *Conn) Ask(req Msg, resp Msg) error {
// ---- exchange of 1-1 request-reply ----
// (impedance matcher for current neo/py imlementation)
// TODO Recv1/Reply/Send1/Ask1 tests
// lightClose closes light connection.
//
// No Send or Recv must be in flight.
// The caller must not use c after call to close - the connection is returned to freelist.
func
(
c
*
Conn
)
lightClose
()
{
nl
:=
c
.
link
nl
.
connMu
.
Lock
()
if
nl
.
connTab
!=
nil
{
// XXX find way to keep initiated by us conn as closed for some time (see Conn.Close)
// but timer costs too much...
delete
(
nl
.
connTab
,
c
.
connId
)
}
nl
.
connMu
.
Unlock
()
c
.
release
()
}
// Request is a message received from the link + connection handle to make a reply.
//
...
...
@@ -1519,8 +1514,7 @@ func (link *NodeLink) Send1(msg Msg) error {
conn
.
downRX
(
errConnClosed
)
// FIXME just new conn this way
err
=
conn
.
Send
(
msg
)
//conn.release() XXX temp
conn
.
Close
()
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