Skip to content

Commit

Permalink
Use prefix as filename prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
fredyshox committed Jul 18, 2023
1 parent 10e9291 commit 2307204
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 4 additions & 2 deletions visionipc/visionipc_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#include <cassert>
#include <iostream>
#include <thread>
#include <filesystem>

#include "cereal/visionipc/ipc.h"
#include "cereal/visionipc/visionipc_client.h"
Expand All @@ -10,10 +11,11 @@

static int connect_to_vipc_server(const std::string &name, bool blocking) {
char* prefix = std::getenv("OPENPILOT_PREFIX");
std::string path = "/tmp/visionipc_" + name;
std::string path = "/tmp/";
if (prefix) {
path = path + "_" + prefix;
path = path + std::string(prefix) + "_";
}
path = path + "visionipc_" + name;

int socket_fd = ipc_connect(path.c_str());
while (socket_fd < 0 && blocking) {
Expand Down
5 changes: 3 additions & 2 deletions visionipc/visionipc_server.cc
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,11 @@ void VisionIpcServer::listener(){
std::cout << "Starting listener for: " << name << std::endl;

char* prefix = std::getenv("OPENPILOT_PREFIX");
std::string path = "/tmp/visionipc_" + name;
std::string path = "/tmp/";
if (prefix) {
path = path + "_" + prefix;
path = path + std::string(prefix) + "_";
}
path = path + "visionipc_" + name;

int sock = ipc_bind(path.c_str());
assert(sock >= 0);
Expand Down

0 comments on commit 2307204

Please sign in to comment.