Commit 288d8469 authored by Niels Möller's avatar Niels Möller
Browse files

* src/write_buffer.h (flow_controlled): New class.

(write_buffer): Added REPORT attribute.

* src/write_buffer.c (write_buffer_consume): Do flow control.

Rev: src/write_buffer.c:1.18
Rev: src/write_buffer.h:1.16
parent ede10d10
......@@ -169,6 +169,9 @@ void write_buffer_consume(struct write_buffer *buffer, UINT32 size)
buffer->start += size;
assert(buffer->start <= buffer->end);
buffer->length -= size;
if (buffer->report)
FLOW_CONTROL_REPORT(buffer->report, size);
}
void write_buffer_close(struct write_buffer *buffer)
......
......@@ -33,6 +33,17 @@
#include "write_buffer.h.x"
#undef GABA_DECLARE
/* For flow control, we use this callback to report that data
* has been flushed from a write_buffer. */
/* GABA:
(class
(name flow_controlled)
(vars
(report method void UINT32)))
*/
#define FLOW_CONTROL_REPORT(o, written) ((o)->report((o), written))
/* For the packet queue */
/* NOTE: No object header */
struct buffer_node
......@@ -50,8 +61,10 @@ struct buffer_node
(buffer space UINT8) ; Size is twice the blocksize
(empty simple int)
; Total amount of data currently in the buffer)
; Total amount of data currently in the buffer
(length . UINT32)
(report object flow_controlled)
; If non-zero, don't accept any more data. The i/o-channel
; should be closed once the current buffers are flushed.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment