Edit according to PR comments
diff --git a/tensorflow/core/distributed_runtime/rpc/grpc_server_lib.cc b/tensorflow/core/distributed_runtime/rpc/grpc_server_lib.cc
index 7e2c42d..2cfdde5 100644
--- a/tensorflow/core/distributed_runtime/rpc/grpc_server_lib.cc
+++ b/tensorflow/core/distributed_runtime/rpc/grpc_server_lib.cc
@@ -132,7 +132,9 @@
void GrpcServer::MaybeMutateBuilder(::grpc::ServerBuilder* builder) {}
// Look up the port that has been requested for this task in `server_def`.
-Status GrpcServer::GetHostAndPort(const ServerDef& server_def, string* host_name, int* port) const {
+Status GrpcServer::GetHostAndPort(const ServerDef& server_def,
+ string* host_name,
+ int* port) const {
*port = -1;
*host_name = "localhost";
for (const auto& job : server_def.cluster().job()) {
@@ -180,9 +182,7 @@
// otherwise if 'task_index=-1' the program will abort.
int requested_port;
- string host_name;
- TF_RETURN_IF_ERROR(GetHostAndPort(server_def_, &host_name, &requested_port));
- host_name_ = host_name;
+ TF_RETURN_IF_ERROR(GetHostAndPort(server_def_, &host_name_, &requested_port));
SessionOptions sess_opts;
ConfigProto config = server_def_.default_session_config();
diff --git a/tensorflow/core/distributed_runtime/rpc/grpc_server_lib.h b/tensorflow/core/distributed_runtime/rpc/grpc_server_lib.h
index feb174c..8ecf0e1 100644
--- a/tensorflow/core/distributed_runtime/rpc/grpc_server_lib.h
+++ b/tensorflow/core/distributed_runtime/rpc/grpc_server_lib.h
@@ -104,7 +104,9 @@
Status UpdateServerDef(const ServerDef& server_def);
protected:
- virtual Status GetHostAndPort(const ServerDef& server_def, string* host_name, int* port) const;
+ virtual Status GetHostAndPort(const ServerDef& server_def,
+ string* host_name,
+ int* port) const;
Status Init(const GrpcServerOptions& opts = GrpcServerOptions());
// A subclass can override this method to support secure credentials.