|
|
@ -317,9 +317,15 @@ class TestServiceImpl : public TestService::Service { |
|
|
|
|
|
|
|
|
|
|
|
void grpc::testing::interop::RunServer( |
|
|
|
void grpc::testing::interop::RunServer( |
|
|
|
std::shared_ptr<ServerCredentials> creds) { |
|
|
|
std::shared_ptr<ServerCredentials> creds) { |
|
|
|
GPR_ASSERT(FLAGS_port != 0); |
|
|
|
RunServer(creds, FLAGS_port, nullptr); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void grpc::testing::interop::RunServer( |
|
|
|
|
|
|
|
std::shared_ptr<ServerCredentials> creds, const int port, |
|
|
|
|
|
|
|
ServerStartedCondition* server_started_condition) { |
|
|
|
|
|
|
|
GPR_ASSERT(port != 0); |
|
|
|
std::ostringstream server_address; |
|
|
|
std::ostringstream server_address; |
|
|
|
server_address << "0.0.0.0:" << FLAGS_port; |
|
|
|
server_address << "0.0.0.0:" << port; |
|
|
|
TestServiceImpl service; |
|
|
|
TestServiceImpl service; |
|
|
|
|
|
|
|
|
|
|
|
SimpleRequest request; |
|
|
|
SimpleRequest request; |
|
|
@ -333,6 +339,14 @@ void grpc::testing::interop::RunServer( |
|
|
|
} |
|
|
|
} |
|
|
|
std::unique_ptr<Server> server(builder.BuildAndStart()); |
|
|
|
std::unique_ptr<Server> server(builder.BuildAndStart()); |
|
|
|
gpr_log(GPR_INFO, "Server listening on %s", server_address.str().c_str()); |
|
|
|
gpr_log(GPR_INFO, "Server listening on %s", server_address.str().c_str()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Signal that the server has started.
|
|
|
|
|
|
|
|
if (server_started_condition) { |
|
|
|
|
|
|
|
std::unique_lock<std::mutex> lock(server_started_condition->mutex); |
|
|
|
|
|
|
|
server_started_condition->server_started = true; |
|
|
|
|
|
|
|
server_started_condition->condition.notify_all(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
while (!gpr_atm_no_barrier_load(&g_got_sigint)) { |
|
|
|
while (!gpr_atm_no_barrier_load(&g_got_sigint)) { |
|
|
|
gpr_sleep_until(gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), |
|
|
|
gpr_sleep_until(gpr_time_add(gpr_now(GPR_CLOCK_REALTIME), |
|
|
|
gpr_time_from_seconds(5, GPR_TIMESPAN))); |
|
|
|
gpr_time_from_seconds(5, GPR_TIMESPAN))); |
|
|
|