Commit 11ca3691 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent a379376c
...@@ -128,15 +128,21 @@ func TestMasterStorage(t *testing.T) { ...@@ -128,15 +128,21 @@ func TestMasterStorage(t *testing.T) {
} }
// shortcut for net tx event // shortcut for net tx event
// XXX -> NetTx ?
nettx := func(src, dst, pkt string) *xnet.TraceTx { nettx := func(src, dst, pkt string) *xnet.TraceTx {
return &xnet.TraceTx{Src: xaddr(src), Dst: xaddr(dst), Pkt: []byte(pkt)} return &xnet.TraceTx{Src: xaddr(src), Dst: xaddr(dst), Pkt: []byte(pkt)}
} }
// shortcut for net connect event // shortcut for net connect event
// XXX -> NetConnect ?
netconnect := func(src, dst, dialed string) *xnet.TraceConnect { netconnect := func(src, dst, dialed string) *xnet.TraceConnect {
return &xnet.TraceConnect{Src: xaddr(src), Dst: xaddr(dst), Dialed: dialed} return &xnet.TraceConnect{Src: xaddr(src), Dst: xaddr(dst), Dialed: dialed}
} }
netlisten := func(laddr string) *xnet.TraceListen {
return &xnet.TraceListen{Laddr: xaddr(laddr)}
}
Mhost := xnet.NetTrace(net.Host("m"), tracer) Mhost := xnet.NetTrace(net.Host("m"), tracer)
Shost := xnet.NetTrace(net.Host("s"), tracer) Shost := xnet.NetTrace(net.Host("s"), tracer)
...@@ -152,8 +158,7 @@ func TestMasterStorage(t *testing.T) { ...@@ -152,8 +158,7 @@ func TestMasterStorage(t *testing.T) {
}) })
// expect: // expect:
//tc.ExpectNetListen("0") tc.Expect(netlisten("m:0"))
tc.Expect(&xnet.TraceListen{Laddr: ":0"})
// M.clusterState <- RECOVERY // M.clusterState <- RECOVERY
// M.nodeTab <- Node(M) // M.nodeTab <- Node(M)
...@@ -168,8 +173,7 @@ func TestMasterStorage(t *testing.T) { ...@@ -168,8 +173,7 @@ func TestMasterStorage(t *testing.T) {
}) })
// expect: // expect:
//tc.ExpectNetListen("1") tc.Expect(netlisten("s:0"))
tc.Expect(&xnet.TraceListen{Laddr: ":0"})
tc.Expect(netconnect("s:1", "m:1", "m:0")) tc.Expect(netconnect("s:1", "m:1", "m:0"))
......
...@@ -59,7 +59,7 @@ type TraceConnect struct { ...@@ -59,7 +59,7 @@ type TraceConnect struct {
// TraceListen is event corresponding to network listening // TraceListen is event corresponding to network listening
type TraceListen struct { type TraceListen struct {
// XXX also put networker? // XXX also put networker?
Laddr string Laddr net.Addr
} }
// TraceTx is event corresponding to network transmission // TraceTx is event corresponding to network transmission
...@@ -96,7 +96,7 @@ func (nt *netTrace) Listen(laddr string) (net.Listener, error) { ...@@ -96,7 +96,7 @@ func (nt *netTrace) Listen(laddr string) (net.Listener, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
nt.tracer.TraceNetListen(&TraceListen{Laddr: laddr}) nt.tracer.TraceNetListen(&TraceListen{Laddr: l.Addr()})
return &netTraceListener{nt, l}, nil return &netTraceListener{nt, l}, nil
} }
......
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