Remove redundant work serializer usage in c-ares windows code (#28016)

* Remove redundant work serializer usage in c-ares windows code

* Also update method names in trace logs
pull/28222/head
apolcyn 3 years ago committed by GitHub
parent 192928c997
commit cce34f68b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 16
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_windows.cc

@ -150,8 +150,7 @@ class GrpcPolledFdWindows {
GPR_ASSERT(!read_buf_has_data_); GPR_ASSERT(!read_buf_has_data_);
read_buf_ = GRPC_SLICE_MALLOC(4192); read_buf_ = GRPC_SLICE_MALLOC(4192);
if (connect_done_) { if (connect_done_) {
work_serializer_->Run([this]() { ContinueRegisterForOnReadableLocked(); }, ContinueRegisterForOnReadableLocked();
DEBUG_LOCATION);
} else { } else {
GPR_ASSERT(pending_continue_register_for_on_readable_locked_ == false); GPR_ASSERT(pending_continue_register_for_on_readable_locked_ == false);
pending_continue_register_for_on_readable_locked_ = true; pending_continue_register_for_on_readable_locked_ = true;
@ -160,7 +159,7 @@ class GrpcPolledFdWindows {
void ContinueRegisterForOnReadableLocked() { void ContinueRegisterForOnReadableLocked() {
GRPC_CARES_TRACE_LOG( GRPC_CARES_TRACE_LOG(
"fd:|%s| InnerContinueRegisterForOnReadableLocked " "fd:|%s| ContinueRegisterForOnReadableLocked "
"wsa_connect_error_:%d", "wsa_connect_error_:%d",
GetName(), wsa_connect_error_); GetName(), wsa_connect_error_);
GPR_ASSERT(connect_done_); GPR_ASSERT(connect_done_);
@ -207,8 +206,7 @@ class GrpcPolledFdWindows {
GPR_ASSERT(write_closure_ == nullptr); GPR_ASSERT(write_closure_ == nullptr);
write_closure_ = write_closure; write_closure_ = write_closure;
if (connect_done_) { if (connect_done_) {
work_serializer_->Run( ContinueRegisterForOnWriteableLocked();
[this]() { ContinueRegisterForOnWriteableLocked(); }, DEBUG_LOCATION);
} else { } else {
GPR_ASSERT(pending_continue_register_for_on_writeable_locked_ == false); GPR_ASSERT(pending_continue_register_for_on_writeable_locked_ == false);
pending_continue_register_for_on_writeable_locked_ = true; pending_continue_register_for_on_writeable_locked_ = true;
@ -217,7 +215,7 @@ class GrpcPolledFdWindows {
void ContinueRegisterForOnWriteableLocked() { void ContinueRegisterForOnWriteableLocked() {
GRPC_CARES_TRACE_LOG( GRPC_CARES_TRACE_LOG(
"fd:|%s| InnerContinueRegisterForOnWriteableLocked " "fd:|%s| ContinueRegisterForOnWriteableLocked "
"wsa_connect_error_:%d", "wsa_connect_error_:%d",
GetName(), wsa_connect_error_); GetName(), wsa_connect_error_);
GPR_ASSERT(connect_done_); GPR_ASSERT(connect_done_);
@ -466,12 +464,10 @@ class GrpcPolledFdWindows {
wsa_connect_error_ = WSA_OPERATION_ABORTED; wsa_connect_error_ = WSA_OPERATION_ABORTED;
} }
if (pending_continue_register_for_on_readable_locked_) { if (pending_continue_register_for_on_readable_locked_) {
work_serializer_->Run([this]() { ContinueRegisterForOnReadableLocked(); }, ContinueRegisterForOnReadableLocked();
DEBUG_LOCATION);
} }
if (pending_continue_register_for_on_writeable_locked_) { if (pending_continue_register_for_on_writeable_locked_) {
work_serializer_->Run( ContinueRegisterForOnWriteableLocked();
[this]() { ContinueRegisterForOnWriteableLocked(); }, DEBUG_LOCATION);
} }
GRPC_ERROR_UNREF(error); GRPC_ERROR_UNREF(error);
} }

Loading…
Cancel
Save