aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/cpp')
-rw-r--r--src/main/cpp/blaze.cc23
-rw-r--r--src/main/cpp/blaze_startup_options.cc2
-rw-r--r--src/main/cpp/blaze_startup_options.h2
-rw-r--r--src/main/cpp/blaze_startup_options_common.cc12
4 files changed, 20 insertions, 19 deletions
diff --git a/src/main/cpp/blaze.cc b/src/main/cpp/blaze.cc
index efac21ad5a..3187f1d883 100644
--- a/src/main/cpp/blaze.cc
+++ b/src/main/cpp/blaze.cc
@@ -363,8 +363,9 @@ static vector<string> GetArgumentArray() {
result.push_back("--batch");
}
- if (globals->options.grpc_port != -1) {
- result.push_back("--grpc_port=" + ToString(globals->options.grpc_port));
+ if (globals->options.command_port != -1) {
+ result.push_back(
+ "--command_port=" + ToString(globals->options.command_port));
}
result.push_back("--install_base=" +
@@ -890,7 +891,9 @@ static bool ConnectToServer(BlazeServer *server, bool start) {
"can't get server pid from connection");
}
return true;
- } else {
+ }
+
+ if (start) {
// If we couldn't connect to the server check if there is still a PID file
// and if so, kill the server that wrote it. This can happen e.g. if the
// server is in a GC pause and therefore cannot respond to ping requests and
@@ -900,9 +903,7 @@ static bool ConnectToServer(BlazeServer *server, bool start) {
if (server_pid >= 0) {
kill(server_pid, SIGKILL);
}
- }
- if (start) {
SetScheduling(globals->options.batch_cpu_scheduling,
globals->options.io_nice_level);
@@ -1803,11 +1804,11 @@ int main(int argc, const char *argv[]) {
const string self_path = GetSelfPath();
ComputeBaseDirectories(self_path);
- blaze_server = globals->options.grpc_port >= 0
+ blaze_server = globals->options.command_port >= 0
? static_cast<BlazeServer *>(new GrpcBlazeServer())
: static_cast<BlazeServer *>(new AfUnixBlazeServer());
- if (globals->options.grpc_port < 0 || globals->options.batch) {
+ if (globals->options.command_port < 0 || globals->options.batch) {
// The gRPC server can handle concurrent commands just fine. However, we
// need to be careful not to start two parallel instances in batch mode.
AcquireLock();
@@ -1841,15 +1842,15 @@ bool GrpcBlazeServer::Connect() {
std::string server_dir = globals->options.output_base + "/server";
std::string port;
- if (!ReadFile(server_dir + "/grpc_port", &port)) {
+ if (!ReadFile(server_dir + "/command_port", &port)) {
return false;
}
- if (!ReadFile(server_dir + "/request_cookie_", &request_cookie_)) {
+ if (!ReadFile(server_dir + "/request_cookie", &request_cookie_)) {
return false;
}
- if (!ReadFile(server_dir + "/response_cookie_", &response_cookie_)) {
+ if (!ReadFile(server_dir + "/response_cookie", &response_cookie_)) {
return false;
}
@@ -1865,7 +1866,7 @@ bool GrpcBlazeServer::Connect() {
command_server::PingRequest request;
command_server::PingResponse response;
request.set_cookie(request_cookie_);
- grpc::Status status = client_->Ping(&context, request, &response);
+ grpc::Status status = client->Ping(&context, request, &response);
if (!status.ok()) {
return false;
diff --git a/src/main/cpp/blaze_startup_options.cc b/src/main/cpp/blaze_startup_options.cc
index 1f7a5409b6..a7111e8f06 100644
--- a/src/main/cpp/blaze_startup_options.cc
+++ b/src/main/cpp/blaze_startup_options.cc
@@ -56,7 +56,7 @@ BlazeStartupOptions::BlazeStartupOptions(const BlazeStartupOptions &rhs)
watchfs(rhs.watchfs),
allow_configurable_attributes(rhs.allow_configurable_attributes),
option_sources(rhs.option_sources),
- grpc_port(rhs.grpc_port),
+ command_port(rhs.command_port),
invocation_policy(rhs.invocation_policy),
host_javabase(rhs.host_javabase) {}
diff --git a/src/main/cpp/blaze_startup_options.h b/src/main/cpp/blaze_startup_options.h
index d44cbbee4c..7ffaa836bb 100644
--- a/src/main/cpp/blaze_startup_options.h
+++ b/src/main/cpp/blaze_startup_options.h
@@ -212,7 +212,7 @@ class BlazeStartupOptions {
// Port for gRPC command server. 0 means let the kernel choose, -1 means no
// gRPC command server.
- int grpc_port;
+ int command_port;
// Invocation policy proto. May be NULL.
const char* invocation_policy;
diff --git a/src/main/cpp/blaze_startup_options_common.cc b/src/main/cpp/blaze_startup_options_common.cc
index 54a649931a..a518bd56c0 100644
--- a/src/main/cpp/blaze_startup_options_common.cc
+++ b/src/main/cpp/blaze_startup_options_common.cc
@@ -50,7 +50,7 @@ void BlazeStartupOptions::Init() {
// 3 hours (but only 5 seconds if used within a test)
max_idle_secs = testing ? 5 : (3 * 3600);
oom_more_eagerly_threshold = 100;
- grpc_port = -1;
+ command_port = -1;
oom_more_eagerly = false;
watchfs = false;
invocation_policy = NULL;
@@ -81,7 +81,7 @@ void BlazeStartupOptions::Copy(
lhs->batch_cpu_scheduling = rhs.batch_cpu_scheduling;
lhs->io_nice_level = rhs.io_nice_level;
lhs->max_idle_secs = rhs.max_idle_secs;
- lhs->grpc_port = rhs.grpc_port;
+ lhs->command_port = rhs.command_port;
lhs->oom_more_eagerly = rhs.oom_more_eagerly;
lhs->watchfs = rhs.watchfs;
lhs->allow_configurable_attributes = rhs.allow_configurable_attributes;
@@ -233,11 +233,11 @@ blaze_exit_code::ExitCode BlazeStartupOptions::ProcessArg(
watchfs = false;
option_sources["watchfs"] = rcfile;
} else if ((value = GetUnaryOption(
- arg, next_arg, "--grpc_port")) != NULL) {
- if (!blaze_util::safe_strto32(value, &grpc_port) ||
- grpc_port < -1 || grpc_port > 65535) {
+ arg, next_arg, "--command_port")) != NULL) {
+ if (!blaze_util::safe_strto32(value, &command_port) ||
+ command_port < -1 || command_port > 65535) {
blaze_util::StringPrintf(error,
- "Invalid argument to --grpc_port: '%s'. "
+ "Invalid argument to --command_port: '%s'. "
"Must be a valid port number or -1 to disable the gRPC server.\n",
value);
return blaze_exit_code::BAD_ARGV;