aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/surface/byte_buffer_queue.c
diff options
context:
space:
mode:
authorGravatar Abhishek Kumar <abhikumar@google.com>2015-07-16 18:32:10 -0700
committerGravatar Abhishek Kumar <abhikumar@google.com>2015-07-16 18:32:10 -0700
commit65ef0fffaecf8396cb93b3a76416d099f7b07438 (patch)
treec9e755019c869b6470f242013b8e1e7a1b809161 /src/core/surface/byte_buffer_queue.c
parentc9af31dad084f3fb58a7523e0bcf917a1d98cf3e (diff)
parent5065d72e4306488088d8d5dbb513758a58c41b42 (diff)
Merge pull request #1888 from ctiller/flow-like-lava-to-a-barnyard
Transport/call flow control interface
Diffstat (limited to 'src/core/surface/byte_buffer_queue.c')
-rw-r--r--src/core/surface/byte_buffer_queue.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/core/surface/byte_buffer_queue.c b/src/core/surface/byte_buffer_queue.c
index 7c31bfe5da..e47dc4f4ce 100644
--- a/src/core/surface/byte_buffer_queue.c
+++ b/src/core/surface/byte_buffer_queue.c
@@ -62,6 +62,7 @@ int grpc_bbq_empty(grpc_byte_buffer_queue *q) {
}
void grpc_bbq_push(grpc_byte_buffer_queue *q, grpc_byte_buffer *buffer) {
+ q->bytes += grpc_byte_buffer_length(buffer);
bba_push(&q->filling, buffer);
}
@@ -72,8 +73,11 @@ void grpc_bbq_flush(grpc_byte_buffer_queue *q) {
}
}
+size_t grpc_bbq_bytes(grpc_byte_buffer_queue *q) { return q->bytes; }
+
grpc_byte_buffer *grpc_bbq_pop(grpc_byte_buffer_queue *q) {
grpc_bbq_array temp_array;
+ grpc_byte_buffer *out;
if (q->drain_pos == q->draining.count) {
if (q->filling.count == 0) {
@@ -87,5 +91,7 @@ grpc_byte_buffer *grpc_bbq_pop(grpc_byte_buffer_queue *q) {
q->draining = temp_array;
}
- return q->draining.data[q->drain_pos++];
+ out = q->draining.data[q->drain_pos++];
+ q->bytes -= grpc_byte_buffer_length(out);
+ return out;
}