
FLOW CONTROL DESIGN
-------------------

The primary goal is to be able to support multiple flow control
algorithms, as well as not disallowing transmitting compressed data
independent of the flow algorithm being used.

This design is possibly inspired by gtk-gnutella's design, but since I
can't follow all of the interactions between mq.c, tx_deflate.c, and
tx_link.c, I'm partially reinventing the wheel here. At the same time, I
hope it will be more flexible.

To begin, we have a simple object wrapping the TCPC that provides a
finite queue.  Let's call this object 'tx_link', although the
implementation is not really analogous to 'rx_link'.

The tx_link will reside inside a 'tx_stack' structure, to encapsulate
all the objects involved. The tx_stack is mostly for cleanup purposes,
but also serves as a go-betweener for different objects within it.

When the transmit buffer inside tx_link has become full, it needs to tell
the thing that's feeding it data to stop. What needs to happen here is
not very precisely defined, but it suffices to say that the size of the
message buffer serves as an artificial boundary: once we reach that
point, we have to do "something" to stem the flow of traffic, or risk
occupying all of memory.

So, let's call the thing that's feeding tx_link a 'msg_queue'. The
msg_queue is where the primary implementation of the flow control
algorithms implemented is centered. Since it has to implement multiple
possible algorithms it is an abstract type. Also, the msg_queue is the
primary receptor for all data that eventually crosses into tx_link: when
calling gt_packet_send(), the msg_queue will be the first stopping
point.

The msg_queue will have two operations defined on it: write() and
flow_control(). write() will be called from gt_packet_send() or whatever
that wants to write packets

*unfinished because i realized i'm not considering the situation as
a whole, including what to do when the buffer fills up*

Rate-limiting can be applied to the lower-level TCPC by wrapping it again
and replacing the TCPC in the simple object with the wrapped one. Doing
this separately isolates some of the complexity out of the tx_stack
pathway.

------------


NEW DESIGN






