Commit 3d0666ab authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 235c7466
...@@ -307,7 +307,7 @@ func (nl *NodeLink) serveRecv() { ...@@ -307,7 +307,7 @@ func (nl *NodeLink) serveRecv() {
for { for {
// receive 1 packet // receive 1 packet
pkt, err := nl.recvPkt() pkt, err := nl.recvPkt()
fmt.Printf("recvPkt -> %v, %v\n", pkt, err) //fmt.Printf("recvPkt -> %v, %v\n", pkt, err)
if err != nil { if err != nil {
// on IO error framing over peerLink becomes broken // on IO error framing over peerLink becomes broken
// so we mark node link and all connections as closed and stop service // so we mark node link and all connections as closed and stop service
...@@ -444,7 +444,7 @@ func (nl *NodeLink) serveSend() { ...@@ -444,7 +444,7 @@ func (nl *NodeLink) serveSend() {
case txreq := <-nl.txq: case txreq := <-nl.txq:
err := nl.sendPkt(txreq.pkt) 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 // on IO error framing over peerLink becomes broken
// so mark node link and all connections as closed and stop service // so mark node link and all connections as closed and stop service
......
...@@ -158,7 +158,6 @@ func nodeLinkPipe() (nl1, nl2 *NodeLink) { ...@@ -158,7 +158,6 @@ func nodeLinkPipe() (nl1, nl2 *NodeLink) {
func TestNodeLink(t *testing.T) { func TestNodeLink(t *testing.T) {
// TODO catch exception -> add proper location from it -> t.Fatal (see git-backup) // TODO catch exception -> add proper location from it -> t.Fatal (see git-backup)
/*
// Close vs recvPkt // Close vs recvPkt
nl1, nl2 := _nodeLinkPipe(linkNoRecvSend, linkNoRecvSend) nl1, nl2 := _nodeLinkPipe(linkNoRecvSend, linkNoRecvSend)
wg := WorkGroup() wg := WorkGroup()
...@@ -306,14 +305,14 @@ func TestNodeLink(t *testing.T) { ...@@ -306,14 +305,14 @@ func TestNodeLink(t *testing.T) {
wg = WorkGroup() wg = WorkGroup()
wg.Gox(func() { wg.Gox(func() {
pkt, err := c11.Recv() pkt, err := c11.Recv()
if !(pkt == nil && err == ErrClosedConn) { if !(pkt == nil && err == ErrLinkClosed) {
exc.Raisef("Conn.Recv() after NodeLink close: pkt = %v err = %v", pkt, err) exc.Raisef("Conn.Recv() after NodeLink close: pkt = %v err = %v", pkt, err)
} }
}) })
wg.Gox(func() { wg.Gox(func() {
pkt := &PktBuf{[]byte("data")} pkt := &PktBuf{[]byte("data")}
err := c12.Send(pkt) err := c12.Send(pkt)
if err != ErrClosedConn { if err != ErrLinkClosed {
exc.Raisef("Conn.Send() after NodeLink close: err = %v", err) exc.Raisef("Conn.Send() after NodeLink close: err = %v", err)
} }
}) })
...@@ -323,14 +322,13 @@ func TestNodeLink(t *testing.T) { ...@@ -323,14 +322,13 @@ func TestNodeLink(t *testing.T) {
xclose(c11) xclose(c11)
xclose(c12) xclose(c12)
xclose(nl2) xclose(nl2)
*/
// NodeLink.Close vs Conn.Send/Recv on another side // NodeLink.Close vs Conn.Send/Recv on another side
nl1, nl2 := _nodeLinkPipe(0, linkNoRecvSend) nl1, nl2 = _nodeLinkPipe(0, linkNoRecvSend)
c11 := nl1.NewConn() c11 = nl1.NewConn()
c12 := nl1.NewConn() c12 = nl1.NewConn()
c13 := nl1.NewConn() c13 := nl1.NewConn()
wg := WorkGroup() wg = WorkGroup()
var errRecv error var errRecv error
wg.Gox(func() { wg.Gox(func() {
pkt, err := c11.Recv() pkt, err := c11.Recv()
...@@ -355,8 +353,10 @@ func TestNodeLink(t *testing.T) { ...@@ -355,8 +353,10 @@ func TestNodeLink(t *testing.T) {
xclose(nl2) xclose(nl2)
xwait(wg) xwait(wg)
// XXX denoise vvv
// Recv/Send on another Conn // Recv/Send on another Conn
pkt, err := c13.Recv() pkt, err = c13.Recv()
if !(pkt == nil && err == errRecv) { if !(pkt == nil && err == errRecv) {
t.Fatalf("Conn.Recv 2 after peer NodeLink shutdown: pkt = %v err = %v", pkt, err) t.Fatalf("Conn.Recv 2 after peer NodeLink shutdown: pkt = %v err = %v", pkt, err)
} }
...@@ -409,7 +409,7 @@ func TestNodeLink(t *testing.T) { ...@@ -409,7 +409,7 @@ func TestNodeLink(t *testing.T) {
t.Fatalf("Conn.Send after close and NodeLink close: %v", err) t.Fatalf("Conn.Send after close and NodeLink close: %v", err)
} }
/*
// Conn accept + exchange // Conn accept + exchange
nl1, nl2 = nodeLinkPipe() nl1, nl2 = nodeLinkPipe()
wg = WorkGroup() wg = WorkGroup()
...@@ -495,5 +495,4 @@ func TestNodeLink(t *testing.T) { ...@@ -495,5 +495,4 @@ func TestNodeLink(t *testing.T) {
xclose(c2) xclose(c2)
xclose(nl1) xclose(nl1)
xclose(nl2) xclose(nl2)
*/
} }
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