19int execute_avm_server(
const std::string& input_path,
const std::string& wsdb_path,
const std::string& cdb_path)
21 info(
"Connecting to aztec-wsdb at ", wsdb_path);
22 constexpr int max_retries = 50;
23 constexpr int retry_delay_ms = 100;
25 for (
int attempt = 0; attempt < max_retries; ++attempt) {
29 }
catch (
const std::exception& e) {
30 if (attempt == max_retries - 1) {
31 info(
"Failed to connect to aztec-wsdb after ", max_retries,
" attempts: ", e.what());
34 std::this_thread::sleep_for(std::chrono::milliseconds(retry_delay_ms));
38 info(
"Connecting to CDB at ", cdb_path);
40 for (
int attempt = 0; attempt < max_retries; ++attempt) {
44 }
catch (
const std::exception& e) {
45 if (attempt == max_retries - 1) {
46 info(
"Failed to connect to CDB after ", max_retries,
" attempts: ", e.what());
49 std::this_thread::sleep_for(std::chrono::milliseconds(retry_delay_ms));
55 ipc::ServerOptions opts;
56 opts.max_shm_clients = 1;
57 auto server = ipc::make_server(input_path, opts);
59 info(
"Error: --input path must end with .sock or .shm: ", input_path);
63 info(
"bb-avm-sim listening on ", input_path);
64 ipc::install_default_signal_handlers(*server);
65 auto cancel_simulation_handler = [](
int ) {
72 (void)
std::signal(SIGUSR1, cancel_simulation_handler);
74 if (!server->listen()) {
75 info(
"Error: Could not start IPC server");
79 info(
"bb-avm-sim IPC server ready");
85 auto handler = make_avm_handler(request);