|
|
|
@ -41,7 +41,7 @@ typedef struct mock_endpoint { |
|
|
|
|
} mock_endpoint; |
|
|
|
|
|
|
|
|
|
static void me_read(grpc_endpoint* ep, grpc_slice_buffer* slices, |
|
|
|
|
grpc_closure* cb, bool urgent) { |
|
|
|
|
grpc_closure* cb, bool /*urgent*/) { |
|
|
|
|
mock_endpoint* m = reinterpret_cast<mock_endpoint*>(ep); |
|
|
|
|
gpr_mu_lock(&m->mu); |
|
|
|
|
if (m->read_buffer.count > 0) { |
|
|
|
@ -55,7 +55,7 @@ static void me_read(grpc_endpoint* ep, grpc_slice_buffer* slices, |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void me_write(grpc_endpoint* ep, grpc_slice_buffer* slices, |
|
|
|
|
grpc_closure* cb, void* arg) { |
|
|
|
|
grpc_closure* cb, void* /*arg*/) { |
|
|
|
|
mock_endpoint* m = reinterpret_cast<mock_endpoint*>(ep); |
|
|
|
|
for (size_t i = 0; i < slices->count; i++) { |
|
|
|
|
m->on_write(slices->slices[i]); |
|
|
|
@ -63,13 +63,14 @@ static void me_write(grpc_endpoint* ep, grpc_slice_buffer* slices, |
|
|
|
|
GRPC_CLOSURE_SCHED(cb, GRPC_ERROR_NONE); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void me_add_to_pollset(grpc_endpoint* ep, grpc_pollset* pollset) {} |
|
|
|
|
static void me_add_to_pollset(grpc_endpoint* /*ep*/, |
|
|
|
|
grpc_pollset* /*pollset*/) {} |
|
|
|
|
|
|
|
|
|
static void me_add_to_pollset_set(grpc_endpoint* ep, |
|
|
|
|
grpc_pollset_set* pollset) {} |
|
|
|
|
static void me_add_to_pollset_set(grpc_endpoint* /*ep*/, |
|
|
|
|
grpc_pollset_set* /*pollset*/) {} |
|
|
|
|
|
|
|
|
|
static void me_delete_from_pollset_set(grpc_endpoint* ep, |
|
|
|
|
grpc_pollset_set* pollset) {} |
|
|
|
|
static void me_delete_from_pollset_set(grpc_endpoint* /*ep*/, |
|
|
|
|
grpc_pollset_set* /*pollset*/) {} |
|
|
|
|
|
|
|
|
|
static void me_shutdown(grpc_endpoint* ep, grpc_error* why) { |
|
|
|
|
mock_endpoint* m = reinterpret_cast<mock_endpoint*>(ep); |
|
|
|
@ -93,7 +94,7 @@ static void me_destroy(grpc_endpoint* ep) { |
|
|
|
|
gpr_free(m); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static char* me_get_peer(grpc_endpoint* ep) { |
|
|
|
|
static char* me_get_peer(grpc_endpoint* /*ep*/) { |
|
|
|
|
return gpr_strdup("fake:mock_endpoint"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -102,9 +103,9 @@ static grpc_resource_user* me_get_resource_user(grpc_endpoint* ep) { |
|
|
|
|
return m->resource_user; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static int me_get_fd(grpc_endpoint* ep) { return -1; } |
|
|
|
|
static int me_get_fd(grpc_endpoint* /*ep*/) { return -1; } |
|
|
|
|
|
|
|
|
|
static bool me_can_track_err(grpc_endpoint* ep) { return false; } |
|
|
|
|
static bool me_can_track_err(grpc_endpoint* /*ep*/) { return false; } |
|
|
|
|
|
|
|
|
|
static const grpc_endpoint_vtable vtable = {me_read, |
|
|
|
|
me_write, |
|
|
|
|