Go to the documentation of this file.
23 #include <sys/types.h>
59 for (
i = 0;
i < nslices; ++
i) {
63 *current_data = (*current_data + 1) % 256;
71 const char* test_name,
74 return config.create_fixture(slice_size);
80 size_t* num_blocks,
uint8_t* current_data) {
81 size_t nslices = num_bytes / slice_size + (num_bytes % slice_size ? 1 : 0);
84 size_t num_bytes_left = num_bytes;
88 *num_blocks = nslices;
90 for (
i = 0;
i < nslices; ++
i) {
96 buf[j] = *current_data;
137 state->incoming.slices,
state->incoming.count, &
state->current_read_data);
157 nullptr,
state->max_write_frame_size);
168 state->bytes_written +=
state->current_write_size;
169 if (
state->target_bytes -
state->bytes_written <
170 state->current_write_size) {
171 state->current_write_size =
state->target_bytes -
state->bytes_written;
173 if (
state->current_write_size != 0) {
175 &
state->current_write_data);
200 size_t num_bytes,
size_t write_size,
210 "num_bytes=%" PRIuPTR
" write_size=%" PRIuPTR
" slice_size=%" PRIuPTR
212 num_bytes, write_size, slice_size, shutdown);
218 "Start read and write test with %" PRIuPTR
219 " bytes, slice size %" PRIuPTR,
220 num_bytes, slice_size);
223 state.read_ep =
f.client_ep;
224 state.write_ep =
f.server_ep;
225 state.target_bytes = num_bytes;
226 state.bytes_read = 0;
227 state.current_write_size = write_size;
229 state.bytes_written = 0;
231 state.write_done = 0;
232 state.current_read_data = 0;
233 state.current_write_data = 0;
235 grpc_schedule_on_exec_ctx);
237 grpc_schedule_on_exec_ctx);
239 grpc_schedule_on_exec_ctx);
241 &
state, grpc_schedule_on_exec_ctx);
249 state.bytes_written -=
state.current_write_size;
266 while (!
state.read_done || !
state.write_done) {
295 *fail_count < want_fail_count) {
318 grpc_schedule_on_exec_ctx),
326 grpc_schedule_on_exec_ctx),
332 grpc_schedule_on_exec_ctx),
351 for (
int i = 1;
i <= 8192;
i =
i * 2) {
struct grpc_pollset_worker grpc_pollset_worker
#define GRPC_CLOSURE_INIT(closure, cb, cb_arg, scheduler)
GPRAPI void gpr_mu_unlock(gpr_mu *mu)
static void read_and_write_test_read_handler(void *data, grpc_error_handle error)
gpr_timespec grpc_timeout_seconds_to_deadline(int64_t time_s)
GPRAPI void grpc_slice_buffer_addn(grpc_slice_buffer *sb, grpc_slice *slices, size_t n)
GPRAPI grpc_slice grpc_slice_from_copied_string(const char *source)
void grpc_endpoint_tests(grpc_endpoint_test_config config, grpc_pollset *pollset, gpr_mu *mu)
static void inc_on_failure(void *arg, grpc_error_handle error)
static void end_test(grpc_endpoint_test_config config)
GPRAPI void gpr_free(void *ptr)
void grpc_endpoint_read(grpc_endpoint *ep, grpc_slice_buffer *slices, grpc_closure *cb, bool urgent, int min_progress_size)
GPRAPI void * gpr_malloc(size_t size)
grpc_slice_buffer incoming
static grpc_slice * allocate_blocks(size_t num_bytes, size_t slice_size, size_t *num_blocks, uint8_t *current_data)
grpc_error_handle grpc_pollset_work(grpc_pollset *pollset, grpc_pollset_worker **worker, grpc_core::Timestamp deadline)
#define GRPC_LOG_IF_ERROR(what, error)
static void read_and_write_test_write_handler(void *data, grpc_error_handle error)
#define GRPC_CLOSURE_CREATE(cb, cb_arg, scheduler)
grpc_closure write_scheduler
GPRAPI grpc_slice grpc_slice_malloc(size_t length)
grpc_closure read_scheduler
size_t count_slices(grpc_slice *slices, size_t nslices, int *current_data)
GPRAPI void gpr_log(const char *file, int line, gpr_log_severity severity, const char *format,...) GPR_PRINT_FORMAT_CHECK(4
GPRAPI void grpc_slice_buffer_reset_and_unref(grpc_slice_buffer *sb)
#define GRPC_SLICE_START_PTR(slice)
grpc_slice_buffer outgoing
GPRAPI void gpr_mu_lock(gpr_mu *mu)
void grpc_endpoint_shutdown(grpc_endpoint *ep, grpc_error_handle why)
void grpc_endpoint_destroy(grpc_endpoint *ep)
grpc_error_handle grpc_pollset_kick(grpc_pollset *pollset, grpc_pollset_worker *specific_worker)
GPRAPI void grpc_slice_buffer_init(grpc_slice_buffer *sb)
#define GRPC_ERROR_CREATE_FROM_STATIC_STRING(desc)
#define GRPC_SLICE_LENGTH(slice)
static void wait_for_fail_count(int *fail_count, int want_fail_count)
ABSL_NAMESPACE_BEGIN Time Now()
GPRAPI void grpc_slice_buffer_add(grpc_slice_buffer *sb, grpc_slice slice)
static grpc_pollset * g_pollset
static void write_scheduler(void *data, grpc_error_handle)
grpc_core::ExecCtx exec_ctx
static void read_and_write_test(grpc_endpoint_test_config config, size_t num_bytes, size_t write_size, size_t slice_size, int max_write_frame_size, bool shutdown)
static void Run(const DebugLocation &location, grpc_closure *closure, grpc_error_handle error)
void grpc_slice_buffer_destroy_internal(grpc_slice_buffer *sb)
void grpc_endpoint_write(grpc_endpoint *ep, grpc_slice_buffer *slices, grpc_closure *cb, void *arg, int max_frame_size)
static void multiple_shutdown_test(grpc_endpoint_test_config config)
static grpc_endpoint_test_fixture begin_test(grpc_endpoint_test_config config, const char *test_name, size_t slice_size)
static Timestamp FromTimespecRoundUp(gpr_timespec t)
void grpc_endpoint_add_to_pollset(grpc_endpoint *ep, grpc_pollset *pollset)
uint8_t current_write_data
#define GRPC_ERROR_IS_NONE(err)
size_t current_write_size
static void read_scheduler(void *data, grpc_error_handle)
grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:19