Commit 0a27363b authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 0430db7a
......@@ -584,6 +584,8 @@ func (nl *NodeLink) serveRecv() {
accept = true
}
// XXX cleanup vvv ^^^
/*
// delete temporary conn from .connTab - this way the
// connection will be automatically garbage-collected
......@@ -600,7 +602,7 @@ func (nl *NodeLink) serveRecv() {
conn.shutdownRX(errConnClosed)
}
// don't even try to `conn.rxq <- ...` if .rxdown is ready
// don't even try `conn.rxq <- ...` if conn.rxdown is ready
// ( else since select is picking random ready variant Recv/serveRecv
// could receive something on rxdown Conn sometimes )
rxdown := false
......@@ -637,7 +639,7 @@ func (nl *NodeLink) serveRecv() {
if accept {
// don't even try to `link.acceptq <- ...` if .axdown is ready
// don't even try `link.acceptq <- ...` if link.axdown is ready
// ( else since select is picking random ready variant Accept/serveRecv
// could receive something on axdown Link sometimes )
axdown := false
......
......@@ -201,7 +201,7 @@ func TestNodeLink(t *testing.T) {
xwait(wg)
xclose(nl2)
// Close vs Accept
// {Close,CloseAccept} vs Accept
nl1, nl2 = _nodeLinkPipe(linkNoRecvSend, linkNoRecvSend)
wg = &xsync.WorkGroup{}
wg.Gox(func() {
......@@ -214,13 +214,23 @@ func TestNodeLink(t *testing.T) {
t.Fatalf("NodeLink.Accept() after close: conn = %v, err = %v", c, err)
}
println("222 + 2")
// nl1 is not accepting connections - because it has LinkClient role
// check Accept behaviour.
wg.Gox(func() {
tdelay()
nl1.CloseAccept()
})
c, err = nl1.Accept()
if !(c == nil && xlinkError(err) == ErrLinkNoListen) {
t.Fatalf("NodeLink.Accept() after CloseAccept: conn = %v, err = %v", c, err)
}
xwait(wg)
// nl1 is now not accepting connections - because it was CloseAccept'ed
// check further Accept behaviour.
c, err = nl1.Accept()
if !(c == nil && xlinkError(err) == ErrLinkNoListen) {
t.Fatalf("NodeLink.Accept() on non-listening node link: conn = %v, err = %v", c, err)
}
println("222 + 3")
xclose(nl1)
println("333")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment