clang format

pull/7704/head
Yuchen Zeng 8 years ago
parent 9396ee496b
commit a418ed2ddb
  1. 6
      src/core/ext/resolver/dns/c_ares/grpc_ares_ev_driver.h
  2. 9
      src/core/ext/resolver/dns/c_ares/grpc_ares_ev_driver_posix.c
  3. 24
      src/core/ext/resolver/dns/c_ares/grpc_ares_wrapper.c

@ -38,6 +38,8 @@
typedef struct grpc_ares_ev_driver grpc_ares_ev_driver;
void grpc_ares_notify_on_event(grpc_exec_ctx *exec_ctx, grpc_ares_ev_driver *ev_driver);
void grpc_ares_notify_on_event(grpc_exec_ctx *exec_ctx,
grpc_ares_ev_driver *ev_driver);
grpc_ares_ev_driver *grpc_ares_ev_driver_create(ares_channel *channel, grpc_pollset_set *pollset_set);
grpc_ares_ev_driver *grpc_ares_ev_driver_create(ares_channel *channel,
grpc_pollset_set *pollset_set);

@ -35,7 +35,6 @@
#include "src/core/ext/resolver/dns/c_ares/grpc_ares_ev_driver.h"
#include "src/core/lib/iomgr/ev_posix.h"
#include "src/core/lib/iomgr/sockaddr.h"
@ -101,7 +100,8 @@ static void driver_cb(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
grpc_exec_ctx_flush(exec_ctx);
}
void grpc_ares_notify_on_event(grpc_exec_ctx *exec_ctx, grpc_ares_ev_driver *ev_driver) {
void grpc_ares_notify_on_event(grpc_exec_ctx *exec_ctx,
grpc_ares_ev_driver *ev_driver) {
size_t i;
fd_pair *new_list = NULL;
ev_driver->bitmask =
@ -163,9 +163,8 @@ void grpc_ares_notify_on_event(grpc_exec_ctx *exec_ctx, grpc_ares_ev_driver *ev_
gpr_log(GPR_ERROR, "eof notify_on_event");
}
grpc_ares_ev_driver *grpc_ares_ev_driver_create(ares_channel *channel, grpc_pollset_set *pollset_set) {
grpc_ares_ev_driver *grpc_ares_ev_driver_create(ares_channel *channel,
grpc_pollset_set *pollset_set) {
grpc_ares_ev_driver *ev_driver = gpr_malloc(sizeof(grpc_ares_ev_driver));
ev_driver->channel = channel;
ev_driver->pollset_set = pollset_set;

@ -75,7 +75,7 @@ struct grpc_ares_request {
grpc_closure request_closure;
void *arg;
ares_channel channel;
grpc_ares_ev_driver* ev_driver;
grpc_ares_ev_driver *ev_driver;
};
// struct grpc_pollset_set {
@ -117,7 +117,8 @@ struct grpc_ares_request {
// size_t i;
// fd_pair *new_list = NULL;
// ev_driver->bitmask =
// ares_getsock(*ev_driver->channel, ev_driver->socks, ARES_GETSOCK_MAXNUM);
// ares_getsock(*ev_driver->channel, ev_driver->socks,
// ARES_GETSOCK_MAXNUM);
// grpc_closure_init(&ev_driver->driver_closure, driver_cb, ev_driver);
// for (i = 0; i < ARES_GETSOCK_MAXNUM; i++) {
// char *final_name;
@ -132,7 +133,8 @@ struct grpc_ares_request {
// fdp = gpr_malloc(sizeof(fd_pair));
// fdp->grpc_fd = grpc_fd_create(ev_driver->socks[i], final_name);
// fdp->fd = ev_driver->socks[i];
// grpc_pollset_set_add_fd(exec_ctx, ev_driver->pollset_set, fdp->grpc_fd);
// grpc_pollset_set_add_fd(exec_ctx, ev_driver->pollset_set,
// fdp->grpc_fd);
// // new_fd_pair->grpc_fd = fd;
// // new_fd_pair->next = ev_driver->fds;
// }
@ -175,7 +177,8 @@ struct grpc_ares_request {
// gpr_log(GPR_ERROR, "eof notify_on_event");
// }
//
// static void driver_cb(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error) {
// static void driver_cb(grpc_exec_ctx *exec_ctx, void *arg, grpc_error *error)
// {
// driver *d = arg;
// size_t i;
// gpr_log(GPR_ERROR, "driver_cb");
@ -184,8 +187,10 @@ struct grpc_ares_request {
// for (i = 0; i < ARES_GETSOCK_MAXNUM; i++) {
// ares_process_fd(
// *d->channel,
// ARES_GETSOCK_READABLE(d->bitmask, i) ? d->socks[i] : ARES_SOCKET_BAD,
// ARES_GETSOCK_WRITABLE(d->bitmask, i) ? d->socks[i] : ARES_SOCKET_BAD);
// ARES_GETSOCK_READABLE(d->bitmask, i) ? d->socks[i] :
// ARES_SOCKET_BAD,
// ARES_GETSOCK_WRITABLE(d->bitmask, i) ? d->socks[i] :
// ARES_SOCKET_BAD);
// }
// }
// notify_on_event(exec_ctx, d);
@ -332,7 +337,8 @@ grpc_ares_request *grpc_resolve_address_ares(grpc_exec_ctx *exec_ctx,
status = ares_init(&r->channel);
if (status != ARES_SUCCESS) {
grpc_exec_ctx_sched(exec_ctx, on_done, GRPC_ERROR_CREATE("Failed to init ares"), NULL);
grpc_exec_ctx_sched(exec_ctx, on_done,
GRPC_ERROR_CREATE("Failed to init ares"), NULL);
return r;
}
@ -378,6 +384,4 @@ grpc_error *grpc_ares_init(void) {
return GRPC_ERROR_NONE;
}
void grpc_ares_cleanup(void) {
ares_library_cleanup();
}
void grpc_ares_cleanup(void) { ares_library_cleanup(); }

Loading…
Cancel
Save