diff options
author | Philip Withnall <philip.withnall@collabora.co.uk> | 2014-01-16 16:06:30 +0000 |
---|---|---|
committer | Olivier Crête <olivier.crete@collabora.com> | 2014-01-31 01:49:07 -0500 |
commit | 253be34806bee232df55f2a92609f74a015797da (patch) | |
tree | d87125595c38a584ee7a422d9290245a30dadaab /agent/pseudotcp.h | |
parent | 9661150dcda7939d108e583e7681352f99e581c8 (diff) | |
download | libnice-253be34806bee232df55f2a92609f74a015797da.tar.gz |
agent: Add support for vectored I/O for receives
Add two new public functions:
• nice_agent_recv_messages()
• nice_agent_recv_messages_nonblocking()
which allow receiving multiple messages in a single call, and support
vectors of buffers to receive the messages into.
The existing nice_agent_recv[_nonblocking]() APIs have been left
untouched.
This tidies up a lot of the message handling code internally, and
eliminates a couple of memcpy()s. There are still a few more memcpy()s
on the critical path, which could be eliminated with further work.
In the reliable agent case, every message is memcpy()ed twice: once into
the pseudo-TCP receive buffer, and once out of it. The copy on input
could be eliminated (in the case of in-order delivery of packets) by
receiving directly into the receive buffer. The copy on output can’t be
eliminated except in the I/O callback case (when
nice_agent_attach_recv() has been used), in which case the callback
could be invoked with a pointer directly into the pseudo-TCP receive
buffer.
In the non-reliable agent case, zero memcpy()s are used.
A couple of the more complex socket implementations (TURN and HTTP) have
slow paths during setup, and partially also during normal use. These
could be optimised further, and FIXME comments have been added.
Diffstat (limited to 'agent/pseudotcp.h')
-rw-r--r-- | agent/pseudotcp.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/agent/pseudotcp.h b/agent/pseudotcp.h index f5cd1a9..a43c3d4 100644 --- a/agent/pseudotcp.h +++ b/agent/pseudotcp.h @@ -66,6 +66,8 @@ # define ECONNRESET WSAECONNRESET #endif +#include "agent.h" + G_BEGIN_DECLS /** @@ -403,6 +405,22 @@ gboolean pseudo_tcp_socket_notify_packet(PseudoTcpSocket *self, /** + * pseudo_tcp_socket_notify_message: + * @self: The #PseudoTcpSocket object. + * @message: A #NiceInputMessage containing the received data. + * + * Notify the #PseudoTcpSocket that a new message has arrived, and enqueue the + * data in its buffers to the #PseudoTcpSocket’s receive buffer. + * + * Returns: %TRUE if the packet was processed successfully, %FALSE otherwise + * + * Since: 0.1.5 + */ +gboolean pseudo_tcp_socket_notify_message (PseudoTcpSocket *self, + NiceInputMessage *message); + + +/** * pseudo_tcp_set_debug_level: * @level: The level of debug to set * |