Commit 547a6fa9 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent bca096a5
......@@ -736,11 +736,9 @@ func (c *Conn) err(op string, e error) error {
// ---- exchange of messages ----
//trace:event traceConnRecv(c *Conn /*aaa*/, msg Msg)
//trace:event traceConnSend(c *Conn, msg Msg) // XXX -> traceConnSendPre ?
//XXX temp
//trace:import "lab.nexedi.com/kirr/neo/go/xcommon/xnet/pipenet"
//trace:event traceConnRecv(c *Conn, msg Msg)
//trace:event traceConnSendPre(c *Conn, msg Msg)
// XXX do we also need traceConnSend?
// Recv receives message
// it receives packet and decodes message from it
......@@ -775,7 +773,7 @@ func (c *Conn) Recv() (Msg, error) {
// Send sends message
// it encodes message into packet and sends it
func (c *Conn) Send(msg Msg) error {
traceConnSend(c, msg)
traceConnSendPre(c, msg)
l := msg.NEOMsgEncodedLen()
buf := PktBuf{make([]byte, PktHeadLen + l)} // TODO -> freelist
......
This diff is collapsed.
......@@ -216,7 +216,7 @@ import (
case *ast.StructType:
fmt.Fprintf(&buf, "// %d. %s\n\n", msgCode, typename)
buf.emit("func (_ *%s) NEOMsgCode() uint16 {", typename)
buf.emit("func (*%s) NEOMsgCode() uint16 {", typename)
buf.emit("return %d", msgCode)
buf.emit("}\n")
......
......@@ -47,8 +47,6 @@ import (
"fmt"
)
var _ = fmt.Print
// XXX dup from connection_test
func xwait(w interface { Wait() error }) {
err := w.Wait()
......@@ -75,7 +73,11 @@ func (t *MyTracer) TraceNetTx(ev *xnet.TraceTx) {} // { t.Trace1(ev) }
type traceNeoRecv struct {conn *neo.Conn; msg neo.Msg}
func (t *MyTracer) traceNeoConnRecv(c *neo.Conn, msg neo.Msg) { t.Trace1(&traceNeoRecv{c, msg}) }
type traceNeoSend struct {conn *neo.Conn; msg neo.Msg}
type traceNeoSend struct {
Src, Dst net.Addr
ConnID uint32
Msg neo.Msg
}
func (t *MyTracer) traceNeoConnSend(c *neo.Conn, msg neo.Msg) { t.Trace1(&traceNeoSend{c, msg}) }
......@@ -140,7 +142,7 @@ func TestMasterStorage(t *testing.T) {
tracing.Lock()
neo_traceConnRecv_Attach(pg, tracer.traceNeoConnRecv)
neo_traceConnSend_Attach(pg, tracer.traceNeoConnSend)
neo_traceConnSendPre_Attach(pg, tracer.traceNeoConnSendPre)
tracing.Unlock()
......@@ -177,7 +179,7 @@ func TestMasterStorage(t *testing.T) {
Mctx, Mcancel := context.WithCancel(context.Background())
wg.Gox(func() {
err := M.Run(Mctx)
fmt.Println("err: ", err)
fmt.Println("M err: ", err)
_ = err // XXX
})
......@@ -193,6 +195,7 @@ func TestMasterStorage(t *testing.T) {
Sctx, Scancel := context.WithCancel(context.Background())
wg.Gox(func() {
err := S.Run(Sctx)
fmt.Println("S err: ", err)
_ = err // XXX
})
......@@ -206,15 +209,20 @@ func TestMasterStorage(t *testing.T) {
//)
_ = nettx
tc.Expect(
conntx("s:1", "m:1", 1, RequestIdentification{...})
// ... M adjust nodetab...
conntx("m:1", "s:1", 1, AcceptIdentification{...})
)
// XXX temp
//return
// M <- S .? RequestIdentification{...} + TODO test ID rejects
println("111")
tc.Expect(netlisten("s:0")) // XXX no -> temp only to get complate
println("222")
// XXX temp
return
// M.nodeTab <- Node(S) XXX order can be racy?
......
......@@ -6,9 +6,6 @@ package neo
import (
"lab.nexedi.com/kirr/neo/go/xcommon/tracing"
"unsafe"
"lab.nexedi.com/kirr/neo/go/xcommon/xnet/pipenet"
"net"
)
// traceevent: traceConnRecv(c *Conn, msg Msg)
......@@ -38,55 +35,32 @@ func traceConnRecv_Attach(pg *tracing.ProbeGroup, probe func(c *Conn, msg Msg))
return &p.Probe
}
// traceevent: traceConnSend(c *Conn, msg Msg)
// traceevent: traceConnSendPre(c *Conn, msg Msg)
type _t_traceConnSend struct {
type _t_traceConnSendPre struct {
tracing.Probe
probefunc func(c *Conn, msg Msg)
}
var _traceConnSend *_t_traceConnSend
var _traceConnSendPre *_t_traceConnSendPre
func traceConnSend(c *Conn, msg Msg) {
if _traceConnSend != nil {
_traceConnSend_run(c, msg)
func traceConnSendPre(c *Conn, msg Msg) {
if _traceConnSendPre != nil {
_traceConnSendPre_run(c, msg)
}
}
func _traceConnSend_run(c *Conn, msg Msg) {
for p := _traceConnSend; p != nil; p = (*_t_traceConnSend)(unsafe.Pointer(p.Next())) {
func _traceConnSendPre_run(c *Conn, msg Msg) {
for p := _traceConnSendPre; p != nil; p = (*_t_traceConnSendPre)(unsafe.Pointer(p.Next())) {
p.probefunc(c, msg)
}
}
func traceConnSend_Attach(pg *tracing.ProbeGroup, probe func(c *Conn, msg Msg)) *tracing.Probe {
p := _t_traceConnSend{probefunc: probe}
tracing.AttachProbe(pg, (**tracing.Probe)(unsafe.Pointer(&_traceConnSend)), &p.Probe)
func traceConnSendPre_Attach(pg *tracing.ProbeGroup, probe func(c *Conn, msg Msg)) *tracing.Probe {
p := _t_traceConnSendPre{probefunc: probe}
tracing.AttachProbe(pg, (**tracing.Probe)(unsafe.Pointer(&_traceConnSendPre)), &p.Probe)
return &p.Probe
}
// trace export signature
func _trace_exporthash_bc56cd7a9caf82c14d9586243f763e65afb91ea0() {}
// traceimport: "lab.nexedi.com/kirr/neo/go/xcommon/xnet/pipenet"
// rerun "gotrace gen" if you see link failure ↓↓↓
//go:linkname pipenet_trace_exporthash lab.nexedi.com/kirr/neo/go/xcommon/xnet/pipenet._trace_exporthash_e77a134646e20f099af466ab3192282237d2e547
func pipenet_trace_exporthash()
func init() { pipenet_trace_exporthash() }
//go:linkname pipenet_traceAccept_Attach lab.nexedi.com/kirr/neo/go/xcommon/xnet/pipenet.traceAccept_Attach
func pipenet_traceAccept_Attach(*tracing.ProbeGroup, func(conn net.Conn)) *tracing.Probe
//go:linkname pipenet_traceDial_Attach lab.nexedi.com/kirr/neo/go/xcommon/xnet/pipenet.traceDial_Attach
func pipenet_traceDial_Attach(*tracing.ProbeGroup, func(addr string)) *tracing.Probe
//go:linkname pipenet_traceListen_Attach lab.nexedi.com/kirr/neo/go/xcommon/xnet/pipenet.traceListen_Attach
func pipenet_traceListen_Attach(*tracing.ProbeGroup, func(laddr string)) *tracing.Probe
//go:linkname pipenet_traceNew_Attach lab.nexedi.com/kirr/neo/go/xcommon/xnet/pipenet.traceNew_Attach
func pipenet_traceNew_Attach(*tracing.ProbeGroup, func(name string)) *tracing.Probe
//go:linkname pipenet_traceNewHost_Attach lab.nexedi.com/kirr/neo/go/xcommon/xnet/pipenet.traceNewHost_Attach
func pipenet_traceNewHost_Attach(*tracing.ProbeGroup, func(host *pipenet.Host)) *tracing.Probe
func _trace_exporthash_d2fa0ebb37c3e2bf54309859a1eeb0e831edd435() {}
// Code generated by lab.nexedi.com/kirr/go123/tracing/cmd/gotrace; DO NOT EDIT.
// empty .s so `go build` does not use -complete for go:linkname to work
......@@ -63,10 +63,9 @@ func (st *SyncTracer) Trace1(event interface{}) {
// Get1 receives message with 1 tracing event from a producer
// The consumer, after dealing with the message, must send back an ack.
func (st *SyncTracer) Get1() *SyncTraceMsg {
return <-st.tracech
//msg := <-st.tracech
//fmt.Printf("trace: get1: %T %v\n", msg.Event, msg.Event)
//return msg
msg := <-st.tracech
fmt.Printf("trace: get1: %T %v\n", msg.Event, msg.Event)
return msg
}
......
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