fix bug in rpc client

This commit is contained in:
mykola2312 2025-01-22 23:22:54 +02:00
parent e532b5c57b
commit 0231524afc
2 changed files with 7 additions and 3 deletions

View file

@ -56,7 +56,7 @@ func (rpc *LuxRpcClient) Execute(request LuxRpcRequest) (LuxRpcResponse, LuxRpcE
return rpcRes, rpcErr, err
}
if def.Feed(part[n:]) {
if def.Feed(part[:n]) {
// got full data, either its response or error
if def.HasResponse() {
xmlBytes := def.GetAndForget()

View file

@ -38,7 +38,11 @@ func (rpc *LuxRpcServer) HandleRequest(request LuxRpcRequest, rpcType LuxRpcType
}, 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 {
@ -90,7 +94,7 @@ func (rpc *LuxRpcServer) AddEndpoint(network string, listenOn string, rpcType Lu
var cmd LuxRpcRequest
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
}