Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/server_service' into server_service
Browse files Browse the repository at this point in the history
  • Loading branch information
elkanatovey committed Dec 7, 2022
2 parents 956e12a + f448803 commit 0ed00c7
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/internals/protos/distribicom.proto
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ message WorkerRegistryRequest {

// the port the worker is listening to.
uint32 workerPort = 2;

string worker_ip=3;
}

// Every subscriber should have a certificate it created to ensure the connections from the server
Expand Down Expand Up @@ -213,4 +215,6 @@ message WorkerConfigs {

// the port the worker is listening to.
uint32 workerPort = 2;

string worker_ip=3;
};
3 changes: 2 additions & 1 deletion src/services/factory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ services::configurations::create_app_configs(const std::string &server_hostname,
}

distribicom::WorkerConfigs
services::configurations::create_worker_configs(const distribicom::AppConfigs &app_configs, int worker_port) {
services::configurations::create_worker_configs(const distribicom::AppConfigs &app_configs, int worker_port, std::string worker_hostname) {
distribicom::WorkerConfigs c;
c.set_workerport(worker_port);
c.set_worker_ip(worker_hostname);
c.mutable_appconfigs()->CopyFrom(app_configs);
return c;
}
Expand Down
2 changes: 1 addition & 1 deletion src/services/factory.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ namespace services::configurations {
create_app_configs(const std::string &server_hostname, int poly_deg, int logt, int rows, int cols, std::uint64_t
ele_size);

distribicom::WorkerConfigs create_worker_configs(const distribicom::AppConfigs &app_configs, int worker_port);
distribicom::WorkerConfigs create_worker_configs(const distribicom::AppConfigs &app_configs, int worker_port, std::string worker_hostname);

distribicom::ClientConfigs create_client_configs(const distribicom::AppConfigs &app_configs, int client_port);
}
2 changes: 1 addition & 1 deletion src/services/manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace services {
try {

auto requesting_worker = utils::extract_ip(context);
std::string subscribing_worker_address = "localhost:52100";
std::string subscribing_worker_address =request->worker_ip() + ":" + std::to_string(request->workerport());

// creating client to the worker:
auto worker_conn = std::make_unique<distribicom::Worker::Stub>(distribicom::Worker::Stub(
Expand Down
1 change: 1 addition & 0 deletions src/services/worker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ namespace services {
distribicom::WorkerRegistryRequest request;

request.set_workerport(cnfgs.workerport());
request.set_worker_ip(cnfgs.worker_ip());

manager_conn->RegisterAsWorker(&context, request, &response);
strategy = std::make_shared<work_strategy::RowMultiplicationStrategy>(
Expand Down
3 changes: 2 additions & 1 deletion test/services/worker_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ std::thread setupWorker(std::latch &wg, distribicom::AppConfigs &configs) {
services::Worker worker(
services::configurations::create_worker_configs(
configs,
std::stoi(std::string(worker_port))
std::stoi(std::string(worker_port)),
"0.0.0.0"
)
);

Expand Down

0 comments on commit 0ed00c7

Please sign in to comment.