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

.

parent 0430db7a
...@@ -584,6 +584,8 @@ func (nl *NodeLink) serveRecv() { ...@@ -584,6 +584,8 @@ func (nl *NodeLink) serveRecv() {
accept = true accept = true
} }
// XXX cleanup vvv ^^^
/* /*
// delete temporary conn from .connTab - this way the // delete temporary conn from .connTab - this way the
// connection will be automatically garbage-collected // connection will be automatically garbage-collected
...@@ -600,7 +602,7 @@ func (nl *NodeLink) serveRecv() { ...@@ -600,7 +602,7 @@ func (nl *NodeLink) serveRecv() {
conn.shutdownRX(errConnClosed) 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 // ( else since select is picking random ready variant Recv/serveRecv
// could receive something on rxdown Conn sometimes ) // could receive something on rxdown Conn sometimes )
rxdown := false rxdown := false
...@@ -637,7 +639,7 @@ func (nl *NodeLink) serveRecv() { ...@@ -637,7 +639,7 @@ func (nl *NodeLink) serveRecv() {
if accept { 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 // ( else since select is picking random ready variant Accept/serveRecv
// could receive something on axdown Link sometimes ) // could receive something on axdown Link sometimes )
axdown := false axdown := false
......
...@@ -201,7 +201,7 @@ func TestNodeLink(t *testing.T) { ...@@ -201,7 +201,7 @@ func TestNodeLink(t *testing.T) {
xwait(wg) xwait(wg)
xclose(nl2) xclose(nl2)
// Close vs Accept // {Close,CloseAccept} vs Accept
nl1, nl2 = _nodeLinkPipe(linkNoRecvSend, linkNoRecvSend) nl1, nl2 = _nodeLinkPipe(linkNoRecvSend, linkNoRecvSend)
wg = &xsync.WorkGroup{} wg = &xsync.WorkGroup{}
wg.Gox(func() { wg.Gox(func() {
...@@ -214,13 +214,23 @@ func TestNodeLink(t *testing.T) { ...@@ -214,13 +214,23 @@ func TestNodeLink(t *testing.T) {
t.Fatalf("NodeLink.Accept() after close: conn = %v, err = %v", c, err) t.Fatalf("NodeLink.Accept() after close: conn = %v, err = %v", c, err)
} }
println("222 + 2") println("222 + 2")
// nl1 is not accepting connections - because it has LinkClient role wg.Gox(func() {
// check Accept behaviour. 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() c, err = nl1.Accept()
if !(c == nil && xlinkError(err) == ErrLinkNoListen) { if !(c == nil && xlinkError(err) == ErrLinkNoListen) {
t.Fatalf("NodeLink.Accept() on non-listening node link: conn = %v, err = %v", c, err) t.Fatalf("NodeLink.Accept() on non-listening node link: conn = %v, err = %v", c, err)
} }
println("222 + 3") println("222 + 3")
xclose(nl1) xclose(nl1)
println("333") 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