diff options
author | jiangtaoli2016 <jiangtao@google.com> | 2017-04-15 10:20:51 -0700 |
---|---|---|
committer | jiangtaoli2016 <jiangtao@google.com> | 2017-04-15 10:20:51 -0700 |
commit | e223a6a042b3123a2aee25ec0d3fe42ffd0c43e2 (patch) | |
tree | 041120a077b83bae9f461f8e62dac5b531babaa1 /src/core/lib/transport/byte_stream.h | |
parent | c953b62d396d6168507520d837550f6b12d7e729 (diff) | |
parent | 644e05e79ba04fb0f424cbb8dffce6c3cd3913ec (diff) |
Merge branch 'master' into new_tsi
Diffstat (limited to 'src/core/lib/transport/byte_stream.h')
-rw-r--r-- | src/core/lib/transport/byte_stream.h | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/core/lib/transport/byte_stream.h b/src/core/lib/transport/byte_stream.h index 1fdd5b4d77..381c65fb04 100644 --- a/src/core/lib/transport/byte_stream.h +++ b/src/core/lib/transport/byte_stream.h @@ -49,9 +49,10 @@ typedef struct grpc_byte_stream grpc_byte_stream; struct grpc_byte_stream { uint32_t length; uint32_t flags; - int (*next)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream, - grpc_slice *slice, size_t max_size_hint, - grpc_closure *on_complete); + bool (*next)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream, + size_t max_size_hint, grpc_closure *on_complete); + grpc_error *(*pull)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream, + grpc_slice *slice); void (*destroy)(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream); }; @@ -61,12 +62,20 @@ struct grpc_byte_stream { * * max_size_hint can be set as a hint as to the maximum number * of bytes that would be acceptable to read. + */ +int grpc_byte_stream_next(grpc_exec_ctx *exec_ctx, + grpc_byte_stream *byte_stream, size_t max_size_hint, + grpc_closure *on_complete); + +/* returns the next slice in the byte stream when it is ready (indicated by + * either grpc_byte_stream_next returning 1 or on_complete passed to + * grpc_byte_stream_next is called). * * once a slice is returned into *slice, it is owned by the caller. */ -int grpc_byte_stream_next(grpc_exec_ctx *exec_ctx, - grpc_byte_stream *byte_stream, grpc_slice *slice, - size_t max_size_hint, grpc_closure *on_complete); +grpc_error *grpc_byte_stream_pull(grpc_exec_ctx *exec_ctx, + grpc_byte_stream *byte_stream, + grpc_slice *slice); void grpc_byte_stream_destroy(grpc_exec_ctx *exec_ctx, grpc_byte_stream *byte_stream); |