Guus Sliepen [Tue, 2 Dec 2014 16:14:13 +0000 (17:14 +0100)]
Disable callbacks when closing a connection.
When an application calls utcp_close() on a previously established
connection, the utcp_connection is kept around to handle FIN(ACK)
packets. However, the peer could still send some data, which should not
trigger the receive callback.
Guus Sliepen [Tue, 2 Dec 2014 11:26:57 +0000 (12:26 +0100)]
Fix and refactor send buffer code.
Make generic buffer handling functions and use those. A problem was
found when resizing a buffer; if new data to be put into the buffer was
more than twice as large as the current buffer size, the code would not
reallocate the buffer large enough.
Guus Sliepen [Wed, 1 Oct 2014 17:18:40 +0000 (19:18 +0200)]
Add a poll callback to UTCP connections.
The callback is called whenever the send buffer of a connection is more
than half empty when utcp_timeout() is called. An argument is passed to
the callee informing him of the maximum number of bytes that will be
accepted when calling utcp_send().
- Outgoing connections automatically get a port number >= 32768 assigned.
- *connect() and *accept() get a port number as argument.
- Connections are now stored in a sorted array with O(log(N)) lookup time.