From 0231524afc0372b2939ca0790597c1a06df6620a Mon Sep 17 00:00:00 2001 From: mykola2312 <49044616+mykola2312@users.noreply.github.com> Date: Wed, 22 Jan 2025 23:22:54 +0200 Subject: [PATCH] fix bug in rpc client --- rpc/lux_rpc_client.go | 2 +- rpc/lux_rpc_server.go | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/rpc/lux_rpc_client.go b/rpc/lux_rpc_client.go index d1e2d59..6ba164f 100644 --- a/rpc/lux_rpc_client.go +++ b/rpc/lux_rpc_client.go @@ -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() diff --git a/rpc/lux_rpc_server.go b/rpc/lux_rpc_server.go index 03ccd75..d50391c 100644 --- a/rpc/lux_rpc_server.go +++ b/rpc/lux_rpc_server.go @@ -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 }