aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/util/trickle_endpoint.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/core/util/trickle_endpoint.c')
-rw-r--r--test/core/util/trickle_endpoint.c84
1 files changed, 42 insertions, 42 deletions
diff --git a/test/core/util/trickle_endpoint.c b/test/core/util/trickle_endpoint.c
index d761f72297..c8b54b481d 100644
--- a/test/core/util/trickle_endpoint.c
+++ b/test/core/util/trickle_endpoint.c
@@ -34,25 +34,25 @@
typedef struct {
grpc_endpoint base;
double bytes_per_second;
- grpc_endpoint *wrapped;
+ grpc_endpoint* wrapped;
gpr_timespec last_write;
gpr_mu mu;
grpc_slice_buffer write_buffer;
grpc_slice_buffer writing_buffer;
- grpc_error *error;
+ grpc_error* error;
bool writing;
- grpc_closure *write_cb;
+ grpc_closure* write_cb;
} trickle_endpoint;
-static void te_read(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- grpc_slice_buffer *slices, grpc_closure *cb) {
- trickle_endpoint *te = (trickle_endpoint *)ep;
+static void te_read(grpc_exec_ctx* exec_ctx, grpc_endpoint* ep,
+ grpc_slice_buffer* slices, grpc_closure* cb) {
+ trickle_endpoint* te = (trickle_endpoint*)ep;
grpc_endpoint_read(exec_ctx, te->wrapped, slices, cb);
}
-static void maybe_call_write_cb_locked(grpc_exec_ctx *exec_ctx,
- trickle_endpoint *te) {
+static void maybe_call_write_cb_locked(grpc_exec_ctx* exec_ctx,
+ trickle_endpoint* te) {
if (te->write_cb != NULL && (te->error != GRPC_ERROR_NONE ||
te->write_buffer.length <= WRITE_BUFFER_SIZE)) {
GRPC_CLOSURE_SCHED(exec_ctx, te->write_cb, GRPC_ERROR_REF(te->error));
@@ -60,9 +60,9 @@ static void maybe_call_write_cb_locked(grpc_exec_ctx *exec_ctx,
}
}
-static void te_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- grpc_slice_buffer *slices, grpc_closure *cb) {
- trickle_endpoint *te = (trickle_endpoint *)ep;
+static void te_write(grpc_exec_ctx* exec_ctx, grpc_endpoint* ep,
+ grpc_slice_buffer* slices, grpc_closure* cb) {
+ trickle_endpoint* te = (trickle_endpoint*)ep;
gpr_mu_lock(&te->mu);
GPR_ASSERT(te->write_cb == NULL);
if (te->write_buffer.length == 0) {
@@ -77,28 +77,28 @@ static void te_write(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
gpr_mu_unlock(&te->mu);
}
-static void te_add_to_pollset(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- grpc_pollset *pollset) {
- trickle_endpoint *te = (trickle_endpoint *)ep;
+static void te_add_to_pollset(grpc_exec_ctx* exec_ctx, grpc_endpoint* ep,
+ grpc_pollset* pollset) {
+ trickle_endpoint* te = (trickle_endpoint*)ep;
grpc_endpoint_add_to_pollset(exec_ctx, te->wrapped, pollset);
}
-static void te_add_to_pollset_set(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- grpc_pollset_set *pollset_set) {
- trickle_endpoint *te = (trickle_endpoint *)ep;
+static void te_add_to_pollset_set(grpc_exec_ctx* exec_ctx, grpc_endpoint* ep,
+ grpc_pollset_set* pollset_set) {
+ trickle_endpoint* te = (trickle_endpoint*)ep;
grpc_endpoint_add_to_pollset_set(exec_ctx, te->wrapped, pollset_set);
}
-static void te_delete_from_pollset_set(grpc_exec_ctx *exec_ctx,
- grpc_endpoint *ep,
- grpc_pollset_set *pollset_set) {
- trickle_endpoint *te = (trickle_endpoint *)ep;
+static void te_delete_from_pollset_set(grpc_exec_ctx* exec_ctx,
+ grpc_endpoint* ep,
+ grpc_pollset_set* pollset_set) {
+ trickle_endpoint* te = (trickle_endpoint*)ep;
grpc_endpoint_delete_from_pollset_set(exec_ctx, te->wrapped, pollset_set);
}
-static void te_shutdown(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
- grpc_error *why) {
- trickle_endpoint *te = (trickle_endpoint *)ep;
+static void te_shutdown(grpc_exec_ctx* exec_ctx, grpc_endpoint* ep,
+ grpc_error* why) {
+ trickle_endpoint* te = (trickle_endpoint*)ep;
gpr_mu_lock(&te->mu);
if (te->error == GRPC_ERROR_NONE) {
te->error = GRPC_ERROR_REF(why);
@@ -108,8 +108,8 @@ static void te_shutdown(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep,
grpc_endpoint_shutdown(exec_ctx, te->wrapped, why);
}
-static void te_destroy(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) {
- trickle_endpoint *te = (trickle_endpoint *)ep;
+static void te_destroy(grpc_exec_ctx* exec_ctx, grpc_endpoint* ep) {
+ trickle_endpoint* te = (trickle_endpoint*)ep;
grpc_endpoint_destroy(exec_ctx, te->wrapped);
gpr_mu_destroy(&te->mu);
grpc_slice_buffer_destroy_internal(exec_ctx, &te->write_buffer);
@@ -118,24 +118,24 @@ static void te_destroy(grpc_exec_ctx *exec_ctx, grpc_endpoint *ep) {
gpr_free(te);
}
-static grpc_resource_user *te_get_resource_user(grpc_endpoint *ep) {
- trickle_endpoint *te = (trickle_endpoint *)ep;
+static grpc_resource_user* te_get_resource_user(grpc_endpoint* ep) {
+ trickle_endpoint* te = (trickle_endpoint*)ep;
return grpc_endpoint_get_resource_user(te->wrapped);
}
-static char *te_get_peer(grpc_endpoint *ep) {
- trickle_endpoint *te = (trickle_endpoint *)ep;
+static char* te_get_peer(grpc_endpoint* ep) {
+ trickle_endpoint* te = (trickle_endpoint*)ep;
return grpc_endpoint_get_peer(te->wrapped);
}
-static int te_get_fd(grpc_endpoint *ep) {
- trickle_endpoint *te = (trickle_endpoint *)ep;
+static int te_get_fd(grpc_endpoint* ep) {
+ trickle_endpoint* te = (trickle_endpoint*)ep;
return grpc_endpoint_get_fd(te->wrapped);
}
-static void te_finish_write(grpc_exec_ctx *exec_ctx, void *arg,
- grpc_error *error) {
- trickle_endpoint *te = (trickle_endpoint *)arg;
+static void te_finish_write(grpc_exec_ctx* exec_ctx, void* arg,
+ grpc_error* error) {
+ trickle_endpoint* te = (trickle_endpoint*)arg;
gpr_mu_lock(&te->mu);
te->writing = false;
grpc_slice_buffer_reset_and_unref(&te->writing_buffer);
@@ -153,9 +153,9 @@ static const grpc_endpoint_vtable vtable = {te_read,
te_get_peer,
te_get_fd};
-grpc_endpoint *grpc_trickle_endpoint_create(grpc_endpoint *wrap,
+grpc_endpoint* grpc_trickle_endpoint_create(grpc_endpoint* wrap,
double bytes_per_second) {
- trickle_endpoint *te = (trickle_endpoint *)gpr_malloc(sizeof(*te));
+ trickle_endpoint* te = (trickle_endpoint*)gpr_malloc(sizeof(*te));
te->base.vtable = &vtable;
te->wrapped = wrap;
te->bytes_per_second = bytes_per_second;
@@ -172,9 +172,9 @@ static double ts2dbl(gpr_timespec s) {
return (double)s.tv_sec + 1e-9 * (double)s.tv_nsec;
}
-size_t grpc_trickle_endpoint_trickle(grpc_exec_ctx *exec_ctx,
- grpc_endpoint *ep) {
- trickle_endpoint *te = (trickle_endpoint *)ep;
+size_t grpc_trickle_endpoint_trickle(grpc_exec_ctx* exec_ctx,
+ grpc_endpoint* ep) {
+ trickle_endpoint* te = (trickle_endpoint*)ep;
gpr_mu_lock(&te->mu);
if (!te->writing && te->write_buffer.length > 0) {
gpr_timespec now = gpr_now(GPR_CLOCK_MONOTONIC);
@@ -198,8 +198,8 @@ size_t grpc_trickle_endpoint_trickle(grpc_exec_ctx *exec_ctx,
return backlog;
}
-size_t grpc_trickle_get_backlog(grpc_endpoint *ep) {
- trickle_endpoint *te = (trickle_endpoint *)ep;
+size_t grpc_trickle_get_backlog(grpc_endpoint* ep) {
+ trickle_endpoint* te = (trickle_endpoint*)ep;
gpr_mu_lock(&te->mu);
size_t backlog = te->write_buffer.length;
gpr_mu_unlock(&te->mu);