fix bug in rpc client
This commit is contained in:
parent
e532b5c57b
commit
0231524afc
2 changed files with 7 additions and 3 deletions
|
|
@ -56,7 +56,7 @@ func (rpc *LuxRpcClient) Execute(request LuxRpcRequest) (LuxRpcResponse, LuxRpcE
|
||||||
return rpcRes, rpcErr, err
|
return rpcRes, rpcErr, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if def.Feed(part[n:]) {
|
if def.Feed(part[:n]) {
|
||||||
// got full data, either its response or error
|
// got full data, either its response or error
|
||||||
if def.HasResponse() {
|
if def.HasResponse() {
|
||||||
xmlBytes := def.GetAndForget()
|
xmlBytes := def.GetAndForget()
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,11 @@ func (rpc *LuxRpcServer) HandleRequest(request LuxRpcRequest, rpcType LuxRpcType
|
||||||
}, false
|
}, false
|
||||||
}
|
}
|
||||||
|
|
||||||
return ctrl.Handle(request, rpcType)
|
rpcRes, rpcErr, err := ctrl.Handle(request, rpcType)
|
||||||
|
rpcRes.RequestID = request.RequestID
|
||||||
|
rpcErr.RequestID = request.RequestID
|
||||||
|
|
||||||
|
return rpcRes, rpcErr, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (rpc *LuxRpcServer) AddEndpoint(network string, listenOn string, rpcType LuxRpcType) error {
|
func (rpc *LuxRpcServer) AddEndpoint(network string, listenOn string, rpcType LuxRpcType) error {
|
||||||
|
|
@ -90,7 +94,7 @@ func (rpc *LuxRpcServer) AddEndpoint(network string, listenOn string, rpcType Lu
|
||||||
|
|
||||||
var cmd LuxRpcRequest
|
var cmd LuxRpcRequest
|
||||||
if err := xml.Unmarshal(xmlBytes, &cmd); err != nil {
|
if err := xml.Unmarshal(xmlBytes, &cmd); err != nil {
|
||||||
log.Errorf("faield to parse rpc %v: %s", err, string(xmlBytes))
|
log.Errorf("failed to parse rpc %v: %s", err, string(xmlBytes))
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue