Merge branch 'master' into php_interop_ssl_fix

pull/1134/head
murgatroid99 10 years ago
commit b2863f50f5
  1. 22
      src/compiler/python_generator.cc
  2. 34
      src/core/iomgr/iocp_windows.c
  3. 1
      src/core/iomgr/iocp_windows.h
  4. 11
      src/core/iomgr/iomgr.c
  5. 7
      src/core/iomgr/socket_windows.c
  6. 6
      src/core/iomgr/socket_windows.h
  7. 4
      src/core/tsi/ssl_transport_security.c
  8. 2
      src/cpp/common/call.cc
  9. 9
      src/cpp/server/secure_server_credentials.cc
  10. 4
      src/cpp/server/server.cc
  11. 18
      src/cpp/server/server_builder.cc
  12. 4
      src/cpp/server/thread_pool.cc
  13. 4
      test/cpp/end2end/generic_end2end_test.cc
  14. 11
      test/cpp/qps/client_async.cc
  15. 44
      test/cpp/qps/driver.cc
  16. 4
      test/cpp/qps/server_async.cc
  17. 4
      test/cpp/qps/stats.h
  18. 2
      third_party/openssl

@ -309,17 +309,20 @@ bool PrintServerFactory(const grpc::string& package_qualified_service_name,
make_pair(method->name(), output_message_module_and_class)); make_pair(method->name(), output_message_module_and_class));
} }
out->Print("method_service_descriptions = {\n"); out->Print("method_service_descriptions = {\n");
for (auto& name_and_description_constructor : for (auto name_and_description_constructor =
method_description_constructors) { method_description_constructors.begin();
name_and_description_constructor !=
method_description_constructors.end();
name_and_description_constructor++) {
IndentScope raii_descriptions_indent(out); IndentScope raii_descriptions_indent(out);
const grpc::string method_name = name_and_description_constructor.first; const grpc::string method_name = name_and_description_constructor->first;
auto input_message_module_and_class = auto input_message_module_and_class =
input_message_modules_and_classes.find(method_name); input_message_modules_and_classes.find(method_name);
auto output_message_module_and_class = auto output_message_module_and_class =
output_message_modules_and_classes.find(method_name); output_message_modules_and_classes.find(method_name);
out->Print("\"$Method$\": utilities.$Constructor$(\n", "Method", out->Print("\"$Method$\": utilities.$Constructor$(\n", "Method",
method_name, "Constructor", method_name, "Constructor",
name_and_description_constructor.second); name_and_description_constructor->second);
{ {
IndentScope raii_description_arguments_indent(out); IndentScope raii_description_arguments_indent(out);
out->Print("servicer.$Method$,\n", "Method", method_name); out->Print("servicer.$Method$,\n", "Method", method_name);
@ -387,17 +390,20 @@ bool PrintStubFactory(const grpc::string& package_qualified_service_name,
make_pair(method->name(), output_message_module_and_class)); make_pair(method->name(), output_message_module_and_class));
} }
out->Print("method_invocation_descriptions = {\n"); out->Print("method_invocation_descriptions = {\n");
for (auto& name_and_description_constructor : for (auto name_and_description_constructor =
method_description_constructors) { method_description_constructors.begin();
name_and_description_constructor !=
method_description_constructors.end();
name_and_description_constructor++) {
IndentScope raii_descriptions_indent(out); IndentScope raii_descriptions_indent(out);
const grpc::string method_name = name_and_description_constructor.first; const grpc::string method_name = name_and_description_constructor->first;
auto input_message_module_and_class = auto input_message_module_and_class =
input_message_modules_and_classes.find(method_name); input_message_modules_and_classes.find(method_name);
auto output_message_module_and_class = auto output_message_module_and_class =
output_message_modules_and_classes.find(method_name); output_message_modules_and_classes.find(method_name);
out->Print("\"$Method$\": utilities.$Constructor$(\n", "Method", out->Print("\"$Method$\": utilities.$Constructor$(\n", "Method",
method_name, "Constructor", method_name, "Constructor",
name_and_description_constructor.second); name_and_description_constructor->second);
{ {
IndentScope raii_description_arguments_indent(out); IndentScope raii_description_arguments_indent(out);
out->Print( out->Print(

@ -52,10 +52,11 @@ static OVERLAPPED g_iocp_custom_overlap;
static gpr_event g_shutdown_iocp; static gpr_event g_shutdown_iocp;
static gpr_event g_iocp_done; static gpr_event g_iocp_done;
static gpr_atm g_orphans = 0;
static HANDLE g_iocp; static HANDLE g_iocp;
static int do_iocp_work() { static void do_iocp_work() {
BOOL success; BOOL success;
DWORD bytes = 0; DWORD bytes = 0;
DWORD flags = 0; DWORD flags = 0;
@ -71,14 +72,14 @@ static int do_iocp_work() {
gpr_time_to_millis(wait_time)); gpr_time_to_millis(wait_time));
if (!success && !overlapped) { if (!success && !overlapped) {
/* The deadline got attained. */ /* The deadline got attained. */
return 0; return;
} }
GPR_ASSERT(completion_key && overlapped); GPR_ASSERT(completion_key && overlapped);
if (overlapped == &g_iocp_custom_overlap) { if (overlapped == &g_iocp_custom_overlap) {
if (completion_key == (ULONG_PTR) &g_iocp_kick_token) { if (completion_key == (ULONG_PTR) &g_iocp_kick_token) {
/* We were awoken from a kick. */ /* We were awoken from a kick. */
gpr_log(GPR_DEBUG, "do_iocp_work - got a kick"); gpr_log(GPR_DEBUG, "do_iocp_work - got a kick");
return 1; return;
} }
gpr_log(GPR_ERROR, "Unknown custom completion key."); gpr_log(GPR_ERROR, "Unknown custom completion key.");
abort(); abort();
@ -97,8 +98,13 @@ static int do_iocp_work() {
} }
success = WSAGetOverlappedResult(socket->socket, &info->overlapped, &bytes, success = WSAGetOverlappedResult(socket->socket, &info->overlapped, &bytes,
FALSE, &flags); FALSE, &flags);
gpr_log(GPR_DEBUG, "bytes: %u, flags: %u - op %s", bytes, flags, gpr_log(GPR_DEBUG, "bytes: %u, flags: %u - op %s %s", bytes, flags,
success ? "succeeded" : "failed"); success ? "succeeded" : "failed", socket->orphan ? "orphan" : "");
if (socket->orphan) {
grpc_winsocket_destroy(socket);
gpr_atm_full_fetch_add(&g_orphans, -1);
return;
}
info->bytes_transfered = bytes; info->bytes_transfered = bytes;
info->wsa_error = success ? 0 : WSAGetLastError(); info->wsa_error = success ? 0 : WSAGetLastError();
GPR_ASSERT(overlapped == &info->overlapped); GPR_ASSERT(overlapped == &info->overlapped);
@ -113,12 +119,10 @@ static int do_iocp_work() {
} }
gpr_mu_unlock(&socket->state_mu); gpr_mu_unlock(&socket->state_mu);
if (f) f(opaque, 1); if (f) f(opaque, 1);
return 1;
} }
static void iocp_loop(void *p) { static void iocp_loop(void *p) {
while (!gpr_event_get(&g_shutdown_iocp)) { while (gpr_atm_acq_load(&g_orphans) || !gpr_event_get(&g_shutdown_iocp)) {
grpc_maybe_call_delayed_callbacks(NULL, 1); grpc_maybe_call_delayed_callbacks(NULL, 1);
do_iocp_work(); do_iocp_work();
} }
@ -138,13 +142,19 @@ void grpc_iocp_init(void) {
gpr_thd_new(&id, iocp_loop, NULL, NULL); gpr_thd_new(&id, iocp_loop, NULL, NULL);
} }
void grpc_iocp_shutdown(void) { void grpc_iocp_kick(void) {
BOOL success; BOOL success;
gpr_event_set(&g_shutdown_iocp, (void *)1);
success = PostQueuedCompletionStatus(g_iocp, 0, success = PostQueuedCompletionStatus(g_iocp, 0,
(ULONG_PTR) &g_iocp_kick_token, (ULONG_PTR) &g_iocp_kick_token,
&g_iocp_custom_overlap); &g_iocp_custom_overlap);
GPR_ASSERT(success); GPR_ASSERT(success);
}
void grpc_iocp_shutdown(void) {
BOOL success;
gpr_event_set(&g_shutdown_iocp, (void *)1);
grpc_iocp_kick();
gpr_event_wait(&g_iocp_done, gpr_inf_future); gpr_event_wait(&g_iocp_done, gpr_inf_future);
success = CloseHandle(g_iocp); success = CloseHandle(g_iocp);
GPR_ASSERT(success); GPR_ASSERT(success);
@ -166,6 +176,10 @@ void grpc_iocp_add_socket(grpc_winsocket *socket) {
GPR_ASSERT(ret == g_iocp); GPR_ASSERT(ret == g_iocp);
} }
void grpc_iocp_socket_orphan(grpc_winsocket *socket) {
gpr_atm_full_fetch_add(&g_orphans, 1);
}
static void socket_notify_on_iocp(grpc_winsocket *socket, static void socket_notify_on_iocp(grpc_winsocket *socket,
void(*cb)(void *, int), void *opaque, void(*cb)(void *, int), void *opaque,
grpc_winsocket_callback_info *info) { grpc_winsocket_callback_info *info) {

@ -42,6 +42,7 @@
void grpc_iocp_init(void); void grpc_iocp_init(void);
void grpc_iocp_shutdown(void); void grpc_iocp_shutdown(void);
void grpc_iocp_add_socket(grpc_winsocket *); void grpc_iocp_add_socket(grpc_winsocket *);
void grpc_iocp_socket_orphan(grpc_winsocket *);
void grpc_socket_notify_on_write(grpc_winsocket *, void(*cb)(void *, int success), void grpc_socket_notify_on_write(grpc_winsocket *, void(*cb)(void *, int success),
void *opaque); void *opaque);

@ -117,7 +117,16 @@ void grpc_iomgr_shutdown(void) {
gpr_mu_lock(&g_mu); gpr_mu_lock(&g_mu);
} }
if (g_refs) { if (g_refs) {
if (gpr_cv_wait(&g_rcv, &g_mu, shutdown_deadline) && g_cbs_head == NULL) { int timeout = 0;
gpr_timespec short_deadline = gpr_time_add(gpr_now(),
gpr_time_from_millis(100));
while (gpr_cv_wait(&g_rcv, &g_mu, short_deadline) && g_cbs_head == NULL) {
if (gpr_time_cmp(gpr_now(), shutdown_deadline) > 0) {
timeout = 1;
break;
}
}
if (timeout) {
gpr_log(GPR_DEBUG, gpr_log(GPR_DEBUG,
"Failed to free %d iomgr objects before shutdown deadline: " "Failed to free %d iomgr objects before shutdown deadline: "
"memory leaks are likely", "memory leaks are likely",

@ -55,7 +55,7 @@ grpc_winsocket *grpc_winsocket_create(SOCKET socket) {
return r; return r;
} }
void shutdown_op(grpc_winsocket_callback_info *info) { static void shutdown_op(grpc_winsocket_callback_info *info) {
if (!info->cb) return; if (!info->cb) return;
grpc_iomgr_add_delayed_callback(info->cb, info->opaque, 0); grpc_iomgr_add_delayed_callback(info->cb, info->opaque, 0);
} }
@ -68,8 +68,13 @@ void grpc_winsocket_shutdown(grpc_winsocket *socket) {
void grpc_winsocket_orphan(grpc_winsocket *socket) { void grpc_winsocket_orphan(grpc_winsocket *socket) {
gpr_log(GPR_DEBUG, "grpc_winsocket_orphan"); gpr_log(GPR_DEBUG, "grpc_winsocket_orphan");
grpc_iocp_socket_orphan(socket);
socket->orphan = 1;
grpc_iomgr_unref(); grpc_iomgr_unref();
closesocket(socket->socket); closesocket(socket->socket);
}
void grpc_winsocket_destroy(grpc_winsocket *socket) {
gpr_mu_destroy(&socket->state_mu); gpr_mu_destroy(&socket->state_mu);
gpr_free(socket); gpr_free(socket);
} }

@ -57,12 +57,13 @@ typedef struct grpc_winsocket_callback_info {
typedef struct grpc_winsocket { typedef struct grpc_winsocket {
SOCKET socket; SOCKET socket;
int added_to_iocp;
grpc_winsocket_callback_info write_info; grpc_winsocket_callback_info write_info;
grpc_winsocket_callback_info read_info; grpc_winsocket_callback_info read_info;
gpr_mu state_mu; gpr_mu state_mu;
int added_to_iocp;
int orphan;
} grpc_winsocket; } grpc_winsocket;
/* Create a wrapped windows handle. /* Create a wrapped windows handle.
@ -71,5 +72,6 @@ grpc_winsocket *grpc_winsocket_create(SOCKET socket);
void grpc_winsocket_shutdown(grpc_winsocket *socket); void grpc_winsocket_shutdown(grpc_winsocket *socket);
void grpc_winsocket_orphan(grpc_winsocket *socket); void grpc_winsocket_orphan(grpc_winsocket *socket);
void grpc_winsocket_destroy(grpc_winsocket *socket);
#endif /* GRPC_INTERNAL_CORE_IOMGR_SOCKET_WINDOWS_H */ #endif /* GRPC_INTERNAL_CORE_IOMGR_SOCKET_WINDOWS_H */

@ -567,7 +567,8 @@ static tsi_result populate_ssl_context(
EC_KEY* ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); EC_KEY* ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1);
if (!SSL_CTX_set_tmp_ecdh(context, ecdh)) { if (!SSL_CTX_set_tmp_ecdh(context, ecdh)) {
gpr_log(GPR_ERROR, "Could not set ephemeral ECDH key."); gpr_log(GPR_ERROR, "Could not set ephemeral ECDH key.");
result = TSI_INTERNAL_ERROR; EC_KEY_free(ecdh);
return TSI_INTERNAL_ERROR;
} }
SSL_CTX_set_options(context, SSL_OP_SINGLE_ECDH_USE); SSL_CTX_set_options(context, SSL_OP_SINGLE_ECDH_USE);
EC_KEY_free(ecdh); EC_KEY_free(ecdh);
@ -604,6 +605,7 @@ static tsi_result build_alpn_protocol_name_list(
unsigned char* current; unsigned char* current;
*protocol_name_list = NULL; *protocol_name_list = NULL;
*protocol_name_list_length = 0; *protocol_name_list_length = 0;
if (num_alpn_protocols == 0) return TSI_INVALID_ARGUMENT;
for (i = 0; i < num_alpn_protocols; i++) { for (i = 0; i < num_alpn_protocols; i++) {
if (alpn_protocols_lengths[i] == 0) { if (alpn_protocols_lengths[i] == 0) {
gpr_log(GPR_ERROR, "Invalid 0-length protocol name."); gpr_log(GPR_ERROR, "Invalid 0-length protocol name.");

@ -148,7 +148,7 @@ void FillMetadataMap(grpc_metadata_array* arr,
// TODO(yangg) handle duplicates? // TODO(yangg) handle duplicates?
metadata->insert(std::pair<grpc::string, grpc::string>( metadata->insert(std::pair<grpc::string, grpc::string>(
arr->metadata[i].key, arr->metadata[i].key,
{arr->metadata[i].value, arr->metadata[i].value_length})); grpc::string(arr->metadata[i].value, arr->metadata[i].value_length)));
} }
grpc_metadata_array_destroy(arr); grpc_metadata_array_destroy(arr);
grpc_metadata_array_init(arr); grpc_metadata_array_init(arr);

@ -59,9 +59,12 @@ class SecureServerCredentials GRPC_FINAL : public ServerCredentials {
std::shared_ptr<ServerCredentials> SslServerCredentials( std::shared_ptr<ServerCredentials> SslServerCredentials(
const SslServerCredentialsOptions& options) { const SslServerCredentialsOptions& options) {
std::vector<grpc_ssl_pem_key_cert_pair> pem_key_cert_pairs; std::vector<grpc_ssl_pem_key_cert_pair> pem_key_cert_pairs;
for (const auto& key_cert_pair : options.pem_key_cert_pairs) { for (auto key_cert_pair = options.pem_key_cert_pairs.begin();
pem_key_cert_pairs.push_back( key_cert_pair != options.pem_key_cert_pairs.end();
{key_cert_pair.private_key.c_str(), key_cert_pair.cert_chain.c_str()}); key_cert_pair++) {
grpc_ssl_pem_key_cert_pair p = {key_cert_pair->private_key.c_str(),
key_cert_pair->cert_chain.c_str()};
pem_key_cert_pairs.push_back(p);
} }
grpc_server_credentials* c_creds = grpc_ssl_server_credentials_create( grpc_server_credentials* c_creds = grpc_ssl_server_credentials_create(
options.pem_root_certs.empty() ? nullptr : options.pem_root_certs.c_str(), options.pem_root_certs.empty() ? nullptr : options.pem_root_certs.c_str(),

@ -247,8 +247,8 @@ bool Server::Start() {
// Start processing rpcs. // Start processing rpcs.
if (!sync_methods_.empty()) { if (!sync_methods_.empty()) {
for (auto& m : sync_methods_) { for (auto m = sync_methods_.begin(); m != sync_methods_.end(); m++) {
m.Request(server_); m->Request(server_);
} }
ScheduleCallback(); ScheduleCallback();

@ -86,24 +86,26 @@ std::unique_ptr<Server> ServerBuilder::BuildAndStart() {
thread_pool_owned = true; thread_pool_owned = true;
} }
std::unique_ptr<Server> server(new Server(thread_pool_, thread_pool_owned)); std::unique_ptr<Server> server(new Server(thread_pool_, thread_pool_owned));
for (auto* service : services_) { for (auto service = services_.begin(); service != services_.end();
if (!server->RegisterService(service)) { service++) {
if (!server->RegisterService(*service)) {
return nullptr; return nullptr;
} }
} }
for (auto* service : async_services_) { for (auto service = async_services_.begin();
if (!server->RegisterAsyncService(service)) { service != async_services_.end(); service++) {
if (!server->RegisterAsyncService(*service)) {
return nullptr; return nullptr;
} }
} }
if (generic_service_) { if (generic_service_) {
server->RegisterAsyncGenericService(generic_service_); server->RegisterAsyncGenericService(generic_service_);
} }
for (auto& port : ports_) { for (auto port = ports_.begin(); port != ports_.end(); port++) {
int r = server->AddListeningPort(port.addr, port.creds.get()); int r = server->AddListeningPort(port->addr, port->creds.get());
if (!r) return nullptr; if (!r) return nullptr;
if (port.selected_port != nullptr) { if (port->selected_port != nullptr) {
*port.selected_port = r; *port->selected_port = r;
} }
} }
if (!server->Start()) { if (!server->Start()) {

@ -66,8 +66,8 @@ ThreadPool::~ThreadPool() {
shutdown_ = true; shutdown_ = true;
cv_.notify_all(); cv_.notify_all();
} }
for (auto& t : threads_) { for (auto t = threads_.begin(); t != threads_.end(); t++) {
t.join(); t->join();
} }
} }

@ -83,8 +83,8 @@ bool ParseFromByteBuffer(ByteBuffer* buffer, grpc::protobuf::Message* message) {
buffer->Dump(&slices); buffer->Dump(&slices);
grpc::string buf; grpc::string buf;
buf.reserve(buffer->Length()); buf.reserve(buffer->Length());
for (const Slice& s : slices) { for (auto s = slices.begin(); s != slices.end(); s++) {
buf.append(reinterpret_cast<const char*>(s.begin()), s.size()); buf.append(reinterpret_cast<const char*>(s->begin()), s->size());
} }
return message->ParseFromString(buf); return message->ParseFromString(buf);
} }

@ -144,7 +144,8 @@ class AsyncClient GRPC_FINAL : public Client {
int t = 0; int t = 0;
for (int i = 0; i < config.outstanding_rpcs_per_channel(); i++) { for (int i = 0; i < config.outstanding_rpcs_per_channel(); i++) {
for (auto& channel : channels_) { for (auto channel = channels_.begin(); channel != channels_.end();
channel++) {
auto* cq = cli_cqs_[t].get(); auto* cq = cli_cqs_[t].get();
t = (t + 1) % cli_cqs_.size(); t = (t + 1) % cli_cqs_.size();
auto start_req = [cq](TestService::Stub* stub, grpc::ClientContext* ctx, auto start_req = [cq](TestService::Stub* stub, grpc::ClientContext* ctx,
@ -152,7 +153,7 @@ class AsyncClient GRPC_FINAL : public Client {
return stub->AsyncUnaryCall(ctx, request, cq, tag); return stub->AsyncUnaryCall(ctx, request, cq, tag);
}; };
TestService::Stub* stub = channel.get_stub(); TestService::Stub* stub = channel->get_stub();
const SimpleRequest& request = request_; const SimpleRequest& request = request_;
new ClientRpcContextUnaryImpl<SimpleRequest, SimpleResponse>( new ClientRpcContextUnaryImpl<SimpleRequest, SimpleResponse>(
stub, request, start_req, check_done); stub, request, start_req, check_done);
@ -165,11 +166,11 @@ class AsyncClient GRPC_FINAL : public Client {
~AsyncClient() GRPC_OVERRIDE { ~AsyncClient() GRPC_OVERRIDE {
EndThreads(); EndThreads();
for (auto& cq : cli_cqs_) { for (auto cq = cli_cqs_.begin(); cq != cli_cqs_.end(); cq++) {
cq->Shutdown(); (*cq)->Shutdown();
void* got_tag; void* got_tag;
bool ok; bool ok;
while (cq->Next(&got_tag, &ok)) { while ((*cq)->Next(&got_tag, &ok)) {
delete ClientRpcContext::detag(got_tag); delete ClientRpcContext::detag(got_tag);
} }
} }

@ -154,19 +154,19 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config,
server_mark.mutable_mark(); server_mark.mutable_mark();
ClientArgs client_mark; ClientArgs client_mark;
client_mark.mutable_mark(); client_mark.mutable_mark();
for (auto& server : servers) { for (auto server = servers.begin(); server != servers.end(); server++) {
GPR_ASSERT(server.stream->Write(server_mark)); GPR_ASSERT(server->stream->Write(server_mark));
} }
for (auto& client : clients) { for (auto client = clients.begin(); client != clients.end(); client++) {
GPR_ASSERT(client.stream->Write(client_mark)); GPR_ASSERT(client->stream->Write(client_mark));
} }
ServerStatus server_status; ServerStatus server_status;
ClientStatus client_status; ClientStatus client_status;
for (auto& server : servers) { for (auto server = servers.begin(); server != servers.end(); server++) {
GPR_ASSERT(server.stream->Read(&server_status)); GPR_ASSERT(server->stream->Read(&server_status));
} }
for (auto& client : clients) { for (auto client = clients.begin(); client != clients.end(); client++) {
GPR_ASSERT(client.stream->Read(&client_status)); GPR_ASSERT(client->stream->Read(&client_status));
} }
// Wait some time // Wait some time
@ -176,33 +176,33 @@ ScenarioResult RunScenario(const ClientConfig& initial_client_config,
// Finish a run // Finish a run
ScenarioResult result; ScenarioResult result;
gpr_log(GPR_INFO, "Finishing"); gpr_log(GPR_INFO, "Finishing");
for (auto& server : servers) { for (auto server = servers.begin(); server != servers.end(); server++) {
GPR_ASSERT(server.stream->Write(server_mark)); GPR_ASSERT(server->stream->Write(server_mark));
} }
for (auto& client : clients) { for (auto client = clients.begin(); client != clients.end(); client++) {
GPR_ASSERT(client.stream->Write(client_mark)); GPR_ASSERT(client->stream->Write(client_mark));
} }
for (auto& server : servers) { for (auto server = servers.begin(); server != servers.end(); server++) {
GPR_ASSERT(server.stream->Read(&server_status)); GPR_ASSERT(server->stream->Read(&server_status));
const auto& stats = server_status.stats(); const auto& stats = server_status.stats();
result.server_resources.push_back(ResourceUsage{ result.server_resources.push_back(ResourceUsage{
stats.time_elapsed(), stats.time_user(), stats.time_system()}); stats.time_elapsed(), stats.time_user(), stats.time_system()});
} }
for (auto& client : clients) { for (auto client = clients.begin(); client != clients.end(); client++) {
GPR_ASSERT(client.stream->Read(&client_status)); GPR_ASSERT(client->stream->Read(&client_status));
const auto& stats = client_status.stats(); const auto& stats = client_status.stats();
result.latencies.MergeProto(stats.latencies()); result.latencies.MergeProto(stats.latencies());
result.client_resources.push_back(ResourceUsage{ result.client_resources.push_back(ResourceUsage{
stats.time_elapsed(), stats.time_user(), stats.time_system()}); stats.time_elapsed(), stats.time_user(), stats.time_system()});
} }
for (auto& client : clients) { for (auto client = clients.begin(); client != clients.end(); client++) {
GPR_ASSERT(client.stream->WritesDone()); GPR_ASSERT(client->stream->WritesDone());
GPR_ASSERT(client.stream->Finish().IsOk()); GPR_ASSERT(client->stream->Finish().IsOk());
} }
for (auto& server : servers) { for (auto server = servers.begin(); server != servers.end(); server++) {
GPR_ASSERT(server.stream->WritesDone()); GPR_ASSERT(server->stream->WritesDone());
GPR_ASSERT(server.stream->Finish().IsOk()); GPR_ASSERT(server->stream->Finish().IsOk());
} }
return result; return result;
} }

@ -105,8 +105,8 @@ class AsyncQpsServerTest : public Server {
~AsyncQpsServerTest() { ~AsyncQpsServerTest() {
server_->Shutdown(); server_->Shutdown();
srv_cq_.Shutdown(); srv_cq_.Shutdown();
for (auto& thr : threads_) { for (auto thr = threads_.begin(); thr != threads_.end(); thr++) {
thr.join(); thr->join();
} }
while (!contexts_.empty()) { while (!contexts_.empty()) {
delete contexts_.front(); delete contexts_.front();

@ -43,8 +43,8 @@ namespace testing {
template <class T, class F> template <class T, class F>
double sum(const T& container, F functor) { double sum(const T& container, F functor) {
double r = 0; double r = 0;
for (auto v : container) { for (auto v = container.begin(); v != container.end(); v++) {
r += functor(v); r += functor(*v);
} }
return r; return r;
} }

@ -1 +1 @@
Subproject commit 4ac0329582829f5378d8078c8d314ad37db87736 Subproject commit 3df69d3aefde7671053d4e3c242b228e5d79c83f
Loading…
Cancel
Save