| | |
| | | } |
| | | } |
| | | |
| | | //func recvandsendRoutine(ctx context.Context, s *bhomebus.Socket, wg *sync.WaitGroup,serveFn func(rdata []byte, rkey int, sdata *[]byte) bool, logFn func(...interface{})) { |
| | | //func recvandsendRoutine(h context.WrapperHandler, s *bhomebus.Socket, wg *sync.WaitGroup,serveFn func(rdata []byte, rkey int, sdata *[]byte) bool, logFn func(...interface{})) { |
| | | // for { |
| | | // select { |
| | | // case <-ctx.Done(): |
| | |
| | | |
| | | if f,ok := ms.handlers[reqBody.Path];ok { |
| | | reqBody.SrcProc = msgR.SrcProc |
| | | ctx := Context{ |
| | | h := WrapperHandler{ |
| | | ms, |
| | | ms, |
| | | } |
| | | ri = f(&ctx, &reqBody) |
| | | ri = f(&h, &reqBody) |
| | | ms.printLog("call funcMap f,reply.Success:", ri.Success) |
| | | } else { |
| | | ms.printLog("ms.funcMap not eixst path: ", reqBody.Path) |
| | |
| | | package bhomeclient |
| | | |
| | | type Context struct { |
| | | type WrapperHandler struct { |
| | | Bk Broker |
| | | Tr Transport |
| | | } |
| | | |
| | | type MicroFunc func(ctx *Context, req *Request) *Reply |
| | | type MicroFunc func(h *WrapperHandler, req *Request) *Reply |
| | | |
| | | |
| | | type Transport interface { |