aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Brennan Saeta <saeta@google.com>2017-03-26 21:09:06 -0800
committerGravatar TensorFlower Gardener <gardener@tensorflow.org>2017-03-26 22:32:41 -0700
commit4347781d74d32016efe49f57121191ec5c39a022 (patch)
treef85acac8fd5304d5c79851fa562c5f550f882b2d
parentc4330cad1e951ec02988e254a44244ca6fc2db69 (diff)
Remove unnecessary instance variable.
requested_port_ is only used within a single function, and thus would be better as a local variable. Change: 151285269
-rw-r--r--tensorflow/core/distributed_runtime/rpc/grpc_server_lib.cc10
-rw-r--r--tensorflow/core/distributed_runtime/rpc/grpc_server_lib.h2
2 files changed, 5 insertions, 7 deletions
diff --git a/tensorflow/core/distributed_runtime/rpc/grpc_server_lib.cc b/tensorflow/core/distributed_runtime/rpc/grpc_server_lib.cc
index 90aee8afcc..ff1df585df 100644
--- a/tensorflow/core/distributed_runtime/rpc/grpc_server_lib.cc
+++ b/tensorflow/core/distributed_runtime/rpc/grpc_server_lib.cc
@@ -117,7 +117,7 @@ Status GrpcServer::Init() {
}
// Look up the port that has been requested for this task in `server_def_`.
- requested_port_ = -1;
+ int requested_port = -1;
for (const auto& job : server_def_.cluster().job()) {
if (job.name() == server_def_.job_name()) {
auto iter = job.tasks().find(server_def_.task_index());
@@ -129,7 +129,7 @@ Status GrpcServer::Init() {
const std::vector<string> hostname_port =
str_util::Split(iter->second, ':');
if (hostname_port.size() != 2 ||
- !strings::safe_strto32(hostname_port[1], &requested_port_)) {
+ !strings::safe_strto32(hostname_port[1], &requested_port)) {
return errors::InvalidArgument(
"Could not parse port for local server from \"", iter->second,
"\"");
@@ -138,13 +138,13 @@ Status GrpcServer::Init() {
}
}
}
- if (requested_port_ == -1) {
+ if (requested_port == -1) {
return errors::Internal("Job \"", server_def_.job_name(),
"\" was not defined in cluster");
}
// N.B. The order of initialization here is intricate, because we
- // wish to allow `requested_port_ == 0` (for choosing any port,
+ // wish to allow `requested_port == 0` (for choosing any port,
// mostly for testing). Therefore, the construction of the channel
// and worker caches depends on `bound_port_`, which is not set
// until we call `builder.BuildAndStart()`. We must create the
@@ -158,7 +158,7 @@ Status GrpcServer::Init() {
// the identities of tasks in the worker pool after the service is
// running.
::grpc::ServerBuilder builder;
- builder.AddListeningPort(strings::StrCat("0.0.0.0:", requested_port_),
+ builder.AddListeningPort(strings::StrCat("0.0.0.0:", requested_port),
GetServerCredentials(server_def_), &bound_port_);
builder.SetMaxMessageSize(std::numeric_limits<int32>::max());
builder.SetOption(
diff --git a/tensorflow/core/distributed_runtime/rpc/grpc_server_lib.h b/tensorflow/core/distributed_runtime/rpc/grpc_server_lib.h
index ff0cbd0bce..c6ba260104 100644
--- a/tensorflow/core/distributed_runtime/rpc/grpc_server_lib.h
+++ b/tensorflow/core/distributed_runtime/rpc/grpc_server_lib.h
@@ -83,8 +83,6 @@ class GrpcServer : public ServerInterface {
const ServerDef server_def_;
Env* env_;
- // The port requested for this server.
- int requested_port_;
// The port to which this server is bound.
int bound_port_ = 0;