Commit 341b2124 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent b78c529a
......@@ -117,7 +117,12 @@ func (tc *TraceChecker) ExpectNetTx(src, dst string, pkt string) {
func TestMasterStorage(t *testing.T) {
tracer := &MyTracer{xtesting.NewSyncTracer()}
tc := xtesting.NewTraceChecker(t, tracer.SyncTracer)
net := xnet.NetTrace(pipenet.New(""), tracer) // test network
//net := xnet.NetTrace(pipenet.New(""), tracer) // test network
net := pipenet.New("testnet") // test network
Mhost := xnet.NetTrace(net.Host("m"), tracer)
Shost := xnet.NetTrace(net.Host("s"), tracer)
Maddr := "0"
Saddr := "1"
......@@ -125,7 +130,7 @@ func TestMasterStorage(t *testing.T) {
wg := &xsync.WorkGroup{}
// start master
M := NewMaster("abc1", Maddr, net)
M := NewMaster("abc1", Maddr, Mhost)
Mctx, Mcancel := context.WithCancel(context.Background())
wg.Gox(func() {
err := M.Run(Mctx)
......@@ -158,6 +163,9 @@ func TestMasterStorage(t *testing.T) {
//tc.Expect(nettx("2c", "2s", "\x00\x00\x00\x01"))
// handshake
tc.Expect(nettx("s:1", "m:1", "\x00\x00\x00\x01"))
tc.Expect(nettx("m:1", "s:1", "\x00\x00\x00\x01"))
//tc.ExpectNetTx("2c", "2s", "\x00\x00\x00\x01") // handshake
//tc.ExpectNetTx("2s", "2c", "\x00\x00\x00\x01")
tc.ExpectPar(
......
......@@ -30,11 +30,13 @@ type Networker interface {
// Network returns name of the network XXX recheck
Network() string
// XXX +Addr() net.Addr -> address of this access-point on underlying network ?
// Dial connects to addr on underlying network
// see net.Dial for semantic details
Dial(ctx context.Context, addr string) (net.Conn, error)
// Listen starts listening on local address laddr on underlying network
// Listen starts listening on local address laddr on underlying network access-point
// see net.Listen for semantic details
//
// XXX also introduce xnet.Listener in which Accept() accepts also ctx?
......
This diff is collapsed.
......@@ -34,6 +34,8 @@ import (
// only Tx events are traced:
// - because Write, contrary to Read, never writes partial data on non-error
// - because in case of pipenet tracing writes only is enough to get whole network exchange picture
//
// XXX Dial/Listen are also traced
func NetTrace(inner Networker, tracer Tracer) Networker {
return &netTrace{inner, tracer}
}
......
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