fix: correct service address handling in grpc plugin (#149)

* fix: correct service address handling in grpc plugin

- Fixed an issue in the grpc plugin where the service address was incorrectly set during communication with native grpc. This change ensures that the service address is now correctly formatted, improving the reliability of grpc interactions.
- Updated the release notes for version 0.10.0 to reflect this fix.

* refactor: improve subprocess command formatting in ExampleRunner
This commit is contained in:
zhangyi1357 2025-01-07 14:36:20 +08:00 committed by GitHub
parent 174804e635
commit f2a42a7a95
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 11 additions and 8 deletions

View File

@ -7,3 +7,4 @@
**次要修改**
- 修复 grpc 插件与原生 grpc 通信时,服务地址设置不正确的问题

View File

@ -37,10 +37,12 @@ class ExampleRunner:
with open(version_file, "r") as f:
version = f.read().strip()
subprocess.run(
["pip3", "install", f"./aimrt_py_pkg/dist/aimrt_py-{version}-cp310-cp310-linux_x86_64.whl", "--force-reinstall"],
cwd=default_build_path,
)
subprocess.run(["pip3",
"install",
f"./aimrt_py_pkg/dist/aimrt_py-{version}-cp310-cp310-linux_x86_64.whl",
"--force-reinstall"],
cwd=default_build_path,
)
subprocess.run(
["bash", os.path.join("build_examples_py_pb_rpc.sh")],
cwd=os.path.join(py_cwd, "pb_rpc"),

View File

@ -163,9 +163,9 @@ bool GrpcRpcBackend::RegisterServiceFunc(
return false;
}
// pb:/aimrt.protocols.example.ExampleService/GetBarData -> /rpc/aimrt.protocols.example.ExampleService/GetBarData
// ros2:/example_ros2/srv/RosTestRpc -> /rpc/example_ros2/srv/RosTestRpc
auto pattern = "/rpc" + std::string(GetRealFuncName(func_name));
// pb:/aimrt.protocols.example.ExampleService/GetBarData -> /aimrt.protocols.example.ExampleService/GetBarData
// ros2:/example_ros2/srv/RosTestRpc -> /example_ros2/srv/RosTestRpc
auto pattern = std::string(GetRealFuncName(func_name));
plugins::grpc_plugin::server::HttpHandle http_handle =
[this, &service_func_wrapper](
@ -369,7 +369,7 @@ void GrpcRpcBackend::Invoke(
return;
}
if (url->path.empty()) {
url->path = "/rpc" + std::string(GetRealFuncName(info.func_name));
url->path = std::string(GetRealFuncName(info.func_name));
}
AIMRT_TRACE("Http2 cli session send request, remote addr {}, path: {}",
url->host, url->path);