| | |
| | | // "encoding/json" |
| | | "errors" |
| | | "fmt" |
| | | json "github.com/json-iterator/go" |
| | | jsoniter "github.com/json-iterator/go" |
| | | "os" |
| | | "sync" |
| | | "time" |
| | |
| | | dest := bhome_msg.BHAddress{} |
| | | if bhsgo.Request(&dest, req, &pid, &mrt, milliSecs) { |
| | | var reply Reply |
| | | var json = jsoniter.ConfigCompatibleWithStandardLibrary |
| | | if err := json.Unmarshal(mrt.Data, &reply); err != nil { |
| | | h.printLog("bhsgo.Request ret true, but unmarshal err:", err, " mrt.Data:", string(mrt.Data)) |
| | | return nil, err |
| | |
| | | } |
| | | |
| | | func (h *BHBus) Reply(src unsafe.Pointer, i *Reply) error { |
| | | var json = jsoniter.ConfigCompatibleWithStandardLibrary |
| | | data, err := json.Marshal(i) |
| | | if err != nil { |
| | | return err |
| | |
| | | import ( |
| | | "basic.com/valib/c_bhomebus.git/proto/source/bhome_msg" |
| | | "context" |
| | | "encoding/json" |
| | | "errors" |
| | | "fmt" |
| | | jsoniter "github.com/json-iterator/go" |
| | | "os" |
| | | "sync" |
| | | "time" |
| | |
| | | |
| | | ms.printLog("1:", time.Since(t)) |
| | | t = time.Now() |
| | | var json = jsoniter.ConfigCompatibleWithStandardLibrary |
| | | rb, _ := json.Marshal(request) |
| | | msgR := &bhome_msg.MsgRequestTopic{ |
| | | Topic: []byte(request.Path), |
| | |
| | | } |
| | | |
| | | func (ms *MicroNode) RequestTopic(serverId string, request Request, milliSecs int) (*Reply, error) { |
| | | var json = jsoniter.ConfigCompatibleWithStandardLibrary |
| | | rb, _ := json.Marshal(request) |
| | | msgR := &bhome_msg.MsgRequestTopic{ |
| | | Topic: []byte(request.Path), |
| | |
| | | if ms.handlers == nil { |
| | | return |
| | | } |
| | | var json = jsoniter.ConfigCompatibleWithStandardLibrary |
| | | |
| | | var reqBody Request |
| | | var ri *Reply |
| | |
| | | package bhomeclient |
| | | |
| | | import ( |
| | | "encoding/json" |
| | | "errors" |
| | | jsoniter "github.com/json-iterator/go" |
| | | ) |
| | | |
| | | type Request struct { |
| | |
| | | } |
| | | |
| | | func (r *Request) BindJSON(v interface{}) error { |
| | | var json = jsoniter.ConfigCompatibleWithStandardLibrary |
| | | return json.Unmarshal(r.Body, &v) |
| | | } |
| | | |