Skip to content

POC RSDK-10720 use TCP if colon in address #435

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/viam/sdk/module/service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,11 @@ ModuleService::~ModuleService() {

void ModuleService::serve() {
server_->register_service(impl_.get());
const std::string address = "unix:" + module_->addr();
std::string address;
if (module_->addr().find(':') == std::string::npos) {
Copy link
Member

@acmorrow acmorrow May 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize this is PoC and may not ever get merged, but this means of deciding that the intention is not to use AF_UNIX is potentially in conflict with fully solving RSDK-10642, because the presence of a : may be involved in helping a module determine whether it has been invoked in a way that is intended to be interpreted as a gRPC endpoint URI (e.g. dns:... or ipv4:... or unix:...), per https://grpc.github.io/grpc/cpp/md_doc_naming.html

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep! Totally agree, this was just to get something that works today available quickly. I will definitely clean this up if/when we want to merge it.

address += "unix:";
}
address += module_->addr();
server_->add_listening_port(address);

module_->set_ready();
Expand Down
6 changes: 5 additions & 1 deletion src/viam/sdk/robot/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,11 @@ std::shared_ptr<RobotClient> RobotClient::at_address(const std::string& address,

std::shared_ptr<RobotClient> RobotClient::at_local_socket(const std::string& address,
const Options& options) {
const std::string addr = "unix://" + address;
std::string addr;
if (address.find(':') == std::string::npos) {
addr += "unix:";
}
addr += address;
auto robot = RobotClient::with_channel(
ViamChannel(sdk::impl::create_viam_channel(addr, grpc::InsecureChannelCredentials())),
options);
Expand Down