Clang format

pull/18809/head
murgatroid99 6 years ago
parent 2f2899203b
commit a36040d51c
  1. 18
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_ev_driver_libuv.cc
  2. 2
      src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper_libuv.cc

@ -36,22 +36,18 @@ namespace grpc_core {
void ares_uv_poll_cb(uv_poll_t* handle, int status, int events); void ares_uv_poll_cb(uv_poll_t* handle, int status, int events);
void ares_uv_poll_close_cb(uv_handle_t *handle) { void ares_uv_poll_close_cb(uv_handle_t* handle) { Delete(handle); }
Delete(handle);
}
class GrpcPolledFdLibuv : public GrpcPolledFd { class GrpcPolledFdLibuv : public GrpcPolledFd {
public: public:
GrpcPolledFdLibuv(ares_socket_t as): as_(as) { GrpcPolledFdLibuv(ares_socket_t as) : as_(as) {
gpr_asprintf(&name_, "c-ares socket: %" PRIdPTR, (intptr_t)as); gpr_asprintf(&name_, "c-ares socket: %" PRIdPTR, (intptr_t)as);
handle_ = New<uv_poll_t>(); handle_ = New<uv_poll_t>();
uv_poll_init_socket(uv_default_loop(), handle_, as); uv_poll_init_socket(uv_default_loop(), handle_, as);
handle_->data = this; handle_->data = this;
} }
~GrpcPolledFdLibuv() { ~GrpcPolledFdLibuv() { gpr_free(name_); }
gpr_free(name_);
}
void RegisterForOnReadableLocked(grpc_closure* read_closure) override { void RegisterForOnReadableLocked(grpc_closure* read_closure) override {
GPR_ASSERT(read_closure_ == nullptr); GPR_ASSERT(read_closure_ == nullptr);
@ -94,11 +90,13 @@ class GrpcPolledFdLibuv : public GrpcPolledFd {
void ares_uv_poll_cb(uv_poll_t* handle, int status, int events) { void ares_uv_poll_cb(uv_poll_t* handle, int status, int events) {
grpc_core::ExecCtx exec_ctx; grpc_core::ExecCtx exec_ctx;
GrpcPolledFdLibuv* polled_fd = reinterpret_cast<GrpcPolledFdLibuv*>(handle->data); GrpcPolledFdLibuv* polled_fd =
grpc_error *error = GRPC_ERROR_NONE; reinterpret_cast<GrpcPolledFdLibuv*>(handle->data);
grpc_error* error = GRPC_ERROR_NONE;
if (status < 0) { if (status < 0) {
error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("cares polling error"); error = GRPC_ERROR_CREATE_FROM_STATIC_STRING("cares polling error");
error = grpc_error_set_str(error, GRPC_ERROR_STR_OS_ERROR, error =
grpc_error_set_str(error, GRPC_ERROR_STR_OS_ERROR,
grpc_slice_from_static_string(uv_strerror(status))); grpc_slice_from_static_string(uv_strerror(status)));
} }
if ((events & UV_READABLE) && polled_fd->read_closure_) { if ((events & UV_READABLE) && polled_fd->read_closure_) {

@ -31,7 +31,7 @@
bool grpc_ares_query_ipv6() { bool grpc_ares_query_ipv6() {
/* The libuv grpc code currently does not have the code to probe for this, /* The libuv grpc code currently does not have the code to probe for this,
* so we assume for nowthat IPv6 is always available in contexts where this * so we assume for now that IPv6 is always available in contexts where this
* code will be used. */ * code will be used. */
return true; return true;
} }

Loading…
Cancel
Save