Olivier Crête [Fri, 21 Feb 2014 19:34:28 +0000 (14:34 -0500)]
agent: returning 0 valid messages is valid, it means EOF
Olivier Crête [Thu, 20 Feb 2014 06:41:22 +0000 (01:41 -0500)]
iostream: iostreams are only for reliable streams, no need to check
Olivier Crête [Thu, 20 Feb 2014 06:40:30 +0000 (01:40 -0500)]
agent: Use locally allocated memory if the application buffer is not big enough for one STUN packet
Olivier Crête [Wed, 19 Feb 2014 04:52:37 +0000 (23:52 -0500)]
outputstream: Trigger the pollable source on error or removal
Olivier Crête [Thu, 13 Feb 2014 20:14:23 +0000 (15:14 -0500)]
agent: Fix compiler warnings
Olivier Crête [Wed, 5 Feb 2014 23:16:02 +0000 (18:16 -0500)]
configure: Add newline ignoring
Otherwise it ran the "yes" command
Olivier Crête [Wed, 5 Feb 2014 02:29:04 +0000 (21:29 -0500)]
configure: Move -Werror=unsafe-loop-optimizations to the maximum level
It tends to cause false warnings
Olivier Crête [Fri, 31 Jan 2014 06:25:57 +0000 (01:25 -0500)]
pseudotcp: Remove one duplicated call to g_get_monotonic_time()
Olivier Crête [Fri, 31 Jan 2014 06:06:08 +0000 (01:06 -0500)]
agent: Remove weak pointers, they aren't thread safe anyway
And we get close to 10% perf boost
Olivier Crête [Fri, 31 Jan 2014 05:18:15 +0000 (00:18 -0500)]
pseudotcp: Add list of unsent segment
Looping through the list of send segment was the only thing from libnice
showing up in my profiler. Keeping a list of segment that were never sent
has made it disappear.
Olivier Crête [Fri, 31 Jan 2014 05:11:04 +0000 (00:11 -0500)]
agent: Avoid calling nice_address_to_string() when debugging is disabled
Olivier Crête [Fri, 31 Jan 2014 04:33:16 +0000 (23:33 -0500)]
pseudotcp: Use GQueue for list that has stuff inserted in the end
Olivier Crête [Fri, 31 Jan 2014 04:08:36 +0000 (23:08 -0500)]
pseudotcp: Don't change the receive buffer size if it hasnt changed
Olivier Crête [Fri, 31 Jan 2014 03:06:32 +0000 (22:06 -0500)]
agent: Restore the ability nice_agent_send() to send partial buffers
This is very important for reliable mode.
Also use it in the GOutputStream so as to not get into the case where
there is still some space in the TCP buffer, but not enough for one message.
Also warn against this problem.
Olivier Crête [Fri, 31 Jan 2014 02:59:33 +0000 (21:59 -0500)]
agent: Replace nice_agent_build_io_stream() with nice_agent_get_io_stream()
Also made the GIOStream into a singleton, it always returns the same one.
Also make it impossible to create a GIOStream for a non-existing stream/component
Olivier Crête [Fri, 31 Jan 2014 02:21:13 +0000 (21:21 -0500)]
Remove the "length" parameter from NiceOutputMessage
It was used correctly only half the time anyway
Olivier Crête [Fri, 31 Jan 2014 01:38:15 +0000 (20:38 -0500)]
Remove the "to" parameter from NiceOutputMessage
We never send multiple messages to separate targets in practice, so
this will simplify the code
Olivier Crête [Thu, 30 Jan 2014 23:37:25 +0000 (18:37 -0500)]
agent: Attaching to a NULL context should attach to the default one
Otherwise it would have attached to a newly created context
Olivier Crête [Fri, 24 Jan 2014 08:02:38 +0000 (03:02 -0500)]
socket: Add note that the packet dropping in tcp-bsd is broken behavior
Philip Withnall [Wed, 22 Jan 2014 12:36:33 +0000 (12:36 +0000)]
tests: Fix test-restart to only quit on state changes
Previously, there was a race between receiving the data packets and
changing state to READY, which would cause one of the final assertions
to fail.
Philip Withnall [Tue, 21 Jan 2014 15:56:18 +0000 (15:56 +0000)]
agent: Add support for vectored I/O for sends
Add one new public function, nice_agent_send_messages_nonblocking(),
which replaces nice_agent_send_full(). This isn’t an API break, because
nice_agent_send_full() hasn’t been in a release yet. The new API allows
sending multiple messages in a single call, and supports vectors of
buffers to transmit the messages from.
The existing nice_agent_send() API has been left untouched, although
it’s a bit of a bugbear because it’s non-blocking and doesn’t fit with
the new *_nonblocking() naming scheme. Oh well.
This doesn’t bring any notable changes to the number of memcpy()s on the
critical path: it remains at zero for the common cases and common socket
types. It introduces the possibility for future work to eliminate some
memcpy()s in more complex socket types, like tcp-turn and tcp-bsd, but
these optimisations have not been made yet. FIXME comments have been
added.
This includes modifications to the test-send-recv unit test to cover the
new API.
Philip Withnall [Mon, 20 Jan 2014 07:56:47 +0000 (07:56 +0000)]
socket: Add vectored I/O support for sending on sockets
Replace the send() API with a send_messages() API, which supports
sending multiple messages, each with multiple buffers rather than a
single monolithic buffer.
This doesn’t break API, as the socket API is not exposed outside
libnice. It does introduce a new struct: NiceOutputMessage, which is
analogous to struct mmsghdr and NiceInputMessage.
This includes updates to the test-bsd test to cover the changed API.
The existing nice_socket_send() API has been retained as a thin wrapper
around nice_socket_send_messages(), for convenience only. It’s hoped
that internal usage of this API will decline to the point where it can
be removed.
Philip Withnall [Tue, 21 Jan 2014 10:50:19 +0000 (10:50 +0000)]
agent: Move gtk-doc comments from agent.c to agent.h for new API
I completely disagree with this, and believe the C file is a much better
place for them, as then they’re:
• easier to read while hacking on the functions, and
• easier to modify once finished hacking on the functions.
I think the argument for putting them in the header files (so that the
documentation is available by the function declarations) is weak, as the
generated gtk-doc manual should be installed on the system alongside the
header files in any case.
Philip Withnall [Thu, 16 Jan 2014 16:11:25 +0000 (16:11 +0000)]
tests: Update test-send-recv to support vectored I/O
Philip Withnall [Thu, 16 Jan 2014 16:06:30 +0000 (16:06 +0000)]
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.
Philip Withnall [Thu, 16 Jan 2014 16:05:12 +0000 (16:05 +0000)]
tests: Fix a shadowed function name in test-pseudotcp
The write() function already exists; we can’t re-define it as a
callback.
Philip Withnall [Thu, 16 Jan 2014 16:02:07 +0000 (16:02 +0000)]
stun: Add a fast version of stun_message_validate_buffer_length()
stun_message_validate_buffer_length() is already fast, but requires the
entire message to be in a single monolithic buffer. For introducing
vectored I/O, this becomes impossible to guarantee.
Rather than rewriting the STUN code to natively support vectors of
buffers (which would be a huge undertaking, and would probably slow
the code down considerably), implement a fast check of whether a message
is likely to be a STUN packet which *does* support vectored I/O. This
can then be used to determine whether to compact the vector of buffers
to a single monolithic one in order to validate the message more
thoroughly.
Philip Withnall [Thu, 16 Jan 2014 16:00:42 +0000 (16:00 +0000)]
socket: Fix the formal parameter types of nice_turn_socket_parse_recv()
gsize and guint8 are more obviously for binary data than gint and gchar.
Note the signedness of the return type has changed: the function never
returns negative values.
Philip Withnall [Thu, 16 Jan 2014 15:45:12 +0000 (15:45 +0000)]
socket: Add vectored I/O support for receiving on sockets
Replace the recv() API with a recv_messages() API, which supports
receiving multiple messages, each with multiple buffers rather than a
single monolithic buffer.
This doesn’t break API, as the socket API is not exposed outside
libnice. It does introduce a new struct: NiceInputMessage, which is
analogous to struct mmsghdr.
This includes updates to the test-bsd test to cover the changed API.
Philip Withnall [Wed, 15 Jan 2014 14:10:34 +0000 (14:10 +0000)]
agent: Simplify control flow in agent_recv_locked()
This introduces no functional changes.
Philip Withnall [Wed, 8 Jan 2014 08:26:41 +0000 (08:26 +0000)]
stun: Use SHA1 iteration functions directly in HMAC calculation
Rather than using an intermediate method which takes a vector of
buffers, just use the SHA1 iteration functions directly in the HMAC
calculations. This eliminates several cases where the vector of buffers
was of fixed length, and it was actually taking more code to set up and
pass the vector than it would have to call the iteration functions
directly.
Olivier Crête [Fri, 31 Jan 2014 02:42:26 +0000 (21:42 -0500)]
outputstream: Put GError in the right GError**
Olivier Crête [Thu, 30 Jan 2014 23:19:19 +0000 (18:19 -0500)]
component: Don't free the nice socket before detaching it
Olivier Crête [Fri, 24 Jan 2014 07:01:29 +0000 (02:01 -0500)]
agent: Make sure there is no integer overflow if the timeout is now
Make sure that if the timeout is now, no negative number is passed as
an unsigned
Olivier Crête [Fri, 24 Jan 2014 06:55:18 +0000 (01:55 -0500)]
pseudotcp: Don't fail when sending over 4GiB of data
Integer comparisons need to take care of rollovers
Olivier Crête [Fri, 24 Jan 2014 06:14:23 +0000 (01:14 -0500)]
outputstream: Fix race between writable callback and GCond wait
Olivier Crête [Fri, 24 Jan 2014 05:53:56 +0000 (00:53 -0500)]
inputstream: Make the GSource hold a weak ref on the agent
This also means that it can't have the component ref. Also make the
cancellable a child source of this GPollableInputStream one
Olivier Crête [Fri, 24 Jan 2014 05:52:01 +0000 (00:52 -0500)]
outputstream: Don't wake up on every input buffer
So instead of actually blocking on the FD, block on a GCancellable
which is triggered when the writable callback is called. Also set the
application's GCancellable as a child of this source.
Olivier Crête [Fri, 24 Jan 2014 04:48:14 +0000 (23:48 -0500)]
agent: Only change pseudotcp clock if the new timeout is sooner
Destroying and creating GSources is expensive, so also don't destroy and
re-create if possible, instead lets use the new g_source_set_ready_time()
Olivier Crête [Fri, 24 Jan 2014 04:47:14 +0000 (23:47 -0500)]
pseudotcp: Switch to using monotonic time
Olivier Crête [Fri, 24 Jan 2014 02:37:43 +0000 (21:37 -0500)]
outputstream: Release blocking send lock while sending
Otherwise it produces a deadlock
Olivier Crête [Fri, 24 Jan 2014 02:03:46 +0000 (21:03 -0500)]
outputstream: Make the blocking send thread safe
There was a possible race between disconnection and freeing of the WriteDatas
structure, now it's ref-counted so it can never happen. Also set the len to -1
if the cancellable was cancelled.
Olivier Crête [Fri, 24 Jan 2014 02:02:07 +0000 (21:02 -0500)]
agent: Return G_IO_ERROR_WOULD_BLOCK for non-connected pseudoTCP
Olivier Crête [Fri, 24 Jan 2014 02:01:41 +0000 (21:01 -0500)]
agent: Return cancelled if sending is cancelled
Olivier Crête [Fri, 24 Jan 2014 00:35:27 +0000 (19:35 -0500)]
nice: Add nice_agent_build_io_stream to exported symbols
Philip Withnall [Tue, 21 Jan 2014 09:55:57 +0000 (09:55 +0000)]
agent: Queue incoming pseudo-TCP messages until ACKs can be sent
If pseudo-TCP messages are received before a socket has been selected
from all the STUN candidates, they would previously be immediately
passed to the pseudo-TCP state machine, which would attempt to send ACKs
for them. This would fail (due to a lack of an outbound UDP socket), and
would incur a retransmit timeout in the TCP state machine. This slowed
down the tests enormously if one agent in a test completed candidate
selection before the other (which is an entirely reasonable scenario).
This never occurred before because the existing tests artificially run
both agents in lock-step, and never send data packets from one to the
other until both have completed candidate selection. This is basically
cheating.
Fix the problem by queuing incoming pseudo-TCP messages until an
outbound UDP socket is available to send the ACKs or SYNACKs on.
Philip Withnall [Tue, 21 Jan 2014 09:51:29 +0000 (09:51 +0000)]
agent: Correct maximum UDP data length
The maximum number of bytes in a UDP packet (ignoring problems like
fragmentation and MTUs) is 65535 = 2^16-1 bytes, as the length field
in the packet header is 16b wide.
Philip Withnall [Mon, 20 Jan 2014 12:07:18 +0000 (12:07 +0000)]
tests: Remove redundant GLIB_CHECK_VERSION checks
Since we define GLIB_VERSION_MIN_REQUIRED, GLib will not emit deprecated
function call warnings for functions like g_type_init() or
g_thread_init().
Philip Withnall [Tue, 14 Jan 2014 13:58:04 +0000 (13:58 +0000)]
agent: Slightly improve debugging output
Philip Withnall [Tue, 14 Jan 2014 10:00:14 +0000 (10:00 +0000)]
agent: Document correctness of io_mutex locking
Philip Withnall [Tue, 14 Jan 2014 09:32:10 +0000 (09:32 +0000)]
agent: Combine nice_agent_recv() and nice_agent_recv_nonblocking()
Sharing is caring.
Philip Withnall [Tue, 14 Jan 2014 08:59:07 +0000 (08:59 +0000)]
agent: Add a couple of comments to the pseudo-TCP implementation
Philip Withnall [Fri, 3 Jan 2014 15:03:08 +0000 (15:03 +0000)]
agent: Hold a reference to pseudotcp while calling its callbacks
This prevents the pseudotcp socket from being destroyed from within a
callback.
Philip Withnall [Fri, 3 Jan 2014 15:02:33 +0000 (15:02 +0000)]
socket: Ensure variables are nullified correctly in UDP sockets
When closing a socket, ensure its private data structure is set to NULL.
When sending a message fails to construct a new socket address, ensure
the pointer to the old address (which has just been unreffed) is removed.
This makes debugging problems with sockets being freed early much
easier.
Philip Withnall [Thu, 2 Jan 2014 15:10:00 +0000 (15:10 +0000)]
tests: Add tests for the I/O stream classes
Philip Withnall [Thu, 9 Jan 2014 18:06:19 +0000 (18:06 +0000)]
agent: Always emit a readable callback when pseudo-TCP data arrives
Previously, the pseudo-TCP implementation’s readable() callback would
only be invoked when new data was received if it was enabled. The
callback is enabled by reading all data from the TCP input buffer until
EWOULDBLOCK is returned.
Reading all that data is not possible if the client buffer is of a
limited size, and can lead to livelocks if the client reads exactly the
number of bytes in the TCP input buffer (i.e. its buffer size matches
the TCP buffer fill level).
Instead, always invoke the readable() callback. This might be slightly
less performant, but the whole pseudo-TCP implementation is a shambles
anyway, and the callbacks need removing, so why not?
Philip Withnall [Tue, 17 Dec 2013 10:30:19 +0000 (10:30 +0000)]
agent: Add GPollableOutputStream support to NiceOutputStream
Philip Withnall [Mon, 16 Dec 2013 14:42:13 +0000 (14:42 +0000)]
agent: Add GPollableInputStream support to NiceInputStream
Philip Withnall [Thu, 9 Jan 2014 17:59:11 +0000 (17:59 +0000)]
agent: Add a nice_agent_recv_nonblocking() function
This is a non-blocking variant of nice_agent_recv(), and will be used
internally by the GPollableInputStream implementation. External
implementations may use it as well.
It reserves the right to iterate the main context, but doesn’t currently
do so.
Philip Withnall [Thu, 12 Dec 2013 11:49:09 +0000 (11:49 +0000)]
agent: Add nice_agent_build_io_stream() API
This allows creation of a NiceIOStream from an existing NiceAgent
instance.
Philip Withnall [Thu, 21 Jan 2010 03:51:45 +0000 (22:51 -0500)]
agent: Add support for GIO-style I/O streams
This adds three new classes:
• NiceIOStream
• NiceInputStream
• NiceOutputStream
which allow wrapping a single stream/component pair in an I/O stream
which can be used with the standard GIO functions.
The streams are constructed as wrappers around a NiceAgent, with changes
to the NiceAgent’s properties affecting all instantiated streams.
Streams are only supported for reliable connections.
If the NiceAgent stream which underlies a NiceInputStream,
NiceOutputStream or NiceIOStream is removed, the I/O stream is marked as
closed.
This is based on work originally done by Youness Alaoui
<youness.alaoui@collabora.co.uk>.
Philip Withnall [Mon, 6 Jan 2014 18:03:20 +0000 (18:03 +0000)]
agent: Add a ComponentSource to Component
This is a type of GSource which proxies all poll events from the sockets
in a Component. It’s necessary for the implementation of
GPollableInputStream and GPollableOutputStream.
This adds no new external API, but does add ComponentSource and
component_source_new() as new internal API.
Philip Withnall [Fri, 3 Jan 2014 11:18:51 +0000 (11:18 +0000)]
agent: Add a nice_agent_send_full() API exposing error information
This adds GError and GCancellable parameters to the existing
nice_agent_send() API, and is identical in all other respects (notably,
it is non-blocking).
The GCancellable is currently unused, but could be used in future if the
API grows to support blocking writes.
The GError is used to return more interesting error codes than just
‘-1’.
Philip Withnall [Mon, 16 Dec 2013 14:02:28 +0000 (14:02 +0000)]
agent: Add nice_agent_recv() allowing blocking receives on sockets
This is a blocking receive function, designed to be called from a worker
thread. It cannot be used in conjunction with the existing
nice_agent_attach_recv() API, as the blocking receive and the GSource
would compete over access to the single copy of the data in the kernel’s
receive buffer.
Philip Withnall [Thu, 2 Jan 2014 15:01:40 +0000 (15:01 +0000)]
agent: Move GSource handling into Component
Rather than handle GSource creation, attachment and removal in
NiceAgent, handle it inside Component. This brings it closer to the
networking code, and improves encapsulation of the state of each
Component.
Philip Withnall [Tue, 17 Dec 2013 09:34:36 +0000 (09:34 +0000)]
agent: Fix format specifiers in debug messages
Mostly problems with the specifier for gsize.
Philip Withnall [Mon, 16 Dec 2013 13:43:35 +0000 (13:43 +0000)]
agent: Support invoking I/O callbacks in non-default contexts
If the Component’s I/O receiver machinery is invoked from a thread which
can’t acquire the main context specified for the I/O callbacks, the
callbacks need to be queued as idle handlers in that main context.
This is needed for the case where blocking reads are being performed in
one thread, with their callbacks needing to be delivered in another
thread.
This introduces a new fine-grained lock to Component: io_mutex. This
protects accesses to Component->io_callback, Component->io_user_data and
Component->pending_io_callbacks. If being locked at the same time as the
main agent lock, it must always be locked afterwards, but the agent lock
does not *have* to be held in order to lock io_mutex.
Philip Withnall [Mon, 16 Dec 2013 11:37:59 +0000 (11:37 +0000)]
agent: Eliminate redundant arguments from component_emit_io_callback()
Philip Withnall [Mon, 16 Dec 2013 11:35:11 +0000 (11:35 +0000)]
agent: Integrate TcpUserData into Component
It was allocated separately and always set, which is a wasted
allocation. Instead, pull the NiceAgent and Stream pointers into the
Component directly, and eliminate the redundant allocation.
This also means the NiceAgent and Stream are available for use elsewhere
in the Component code (not just with TCP stuff).
Philip Withnall [Mon, 16 Dec 2013 11:16:24 +0000 (11:16 +0000)]
agent: Clarify naming of internal recv function
Add ‘_locked’ to the name to clarify that it must be called with the
agent’s lock already held.
Philip Withnall [Mon, 16 Dec 2013 11:10:13 +0000 (11:10 +0000)]
agent: Use guint8* as the type for internal buffers
…rather than gchar*. This differentiates binary buffers from strings a
little better, although the two types are functionally equivalent.
Also use gsize for buffer sizes, rather than guint.
Philip Withnall [Mon, 16 Dec 2013 11:04:30 +0000 (11:04 +0000)]
agent: Move I/O callback handling from NiceAgent into Component
Compartmentalise the handling of setting and clearing the user-provided
per-Component I/O callbacks.
Data flows from the socket, through nice_agent_g_source_cb(), to
component_emit_io_callback() which calls the callback provided by the
user when originally attaching to the stream/component.
Philip Withnall [Mon, 16 Dec 2013 10:26:02 +0000 (10:26 +0000)]
agent: Move socket/source handling from NiceAgent into Component
This compartmentalises it a little more, reducing the spread of
state-changing code from three files down to one.
The key change is the switch from using two GSLists of NiceSockets and
GSources in Component, to using a single GSList of a struct {
NiceSocket, GSource }. This is possible because there is at most one
GSource per NiceSocket. This change reduces memory overhead (from the
GSList structures) slightly, and makes the relationship between sockets
and sources much clearer.
Philip Withnall [Thu, 12 Dec 2013 13:35:18 +0000 (13:35 +0000)]
agent: Refactor nice_agent_g_source_cb()
Move all functionality which is unrelated to the GSource into
_nice_agent_recv().
Philip Withnall [Thu, 2 Jan 2014 14:35:56 +0000 (14:35 +0000)]
agent: Add a NiceAgent::streams-removed signal
This is emitted when one or more streams are removed from the agent
due to a call to nice_agent_remove_stream().
Philip Withnall [Thu, 9 Jan 2014 18:02:26 +0000 (18:02 +0000)]
tests: Remove a potential race from test-thread
A g_usleep() was introduced in commit
e22ecb19662970a42def6df74db6359e58084727 to fix a potential race where
the non-main threads would finish all their work before the error_loop
was started, leaving the error_loop to run for 30s then abort the test.
A better fix, instead of doing a racy sleep, is to have the non-main
threads spin until the error_loop is running. GLib takes care of all the
locking for us, and since we don’t care about efficiency for test cases,
spinning is fine (the wait is also going to be quite short).
Philip Withnall [Fri, 3 Jan 2014 08:52:36 +0000 (08:52 +0000)]
build: Add various compiler warnings to --enable-compile-warnings
Add various compiler warnings to the different levels of
--enable-compile-warnings. No particular scheme has been used to assign
different warnings to different levels, other than that more critical
ones are typically enabled at lower levels upwards.
All code in libnice except the tests currently compiles with
--enable-compile-warnings=error.
Philip Withnall [Tue, 17 Dec 2013 10:05:06 +0000 (10:05 +0000)]
stun: Add missing switch cases
This appeases GCC’s -Wswitch-enum warning, and makes it more obvious
that those enum cases have been explicitly considered, rather than just
forgotten about.
This introduces no functional changes.
Philip Withnall [Tue, 17 Dec 2013 09:43:49 +0000 (09:43 +0000)]
socket: Add missing switch cases
This appeases GCC’s -Wswitch-enum warning, and makes it more obvious
that those enum cases have been explicitly considered, rather than just
forgotten about.
This introduces no functional changes.
Philip Withnall [Tue, 17 Dec 2013 09:24:49 +0000 (09:24 +0000)]
gst: Add missing switch cases
This appeases GCC’s -Wswitch-enum warning, and makes it more obvious
that those enum cases have been explicitly considered, rather than just
forgotten about.
This introduces no functional changes.
Philip Withnall [Tue, 14 Jan 2014 13:57:37 +0000 (13:57 +0000)]
stun: Fix potential zero-length memset() call
GCC warns about this. Might as well prevent the warning.
Philip Withnall [Wed, 15 Jan 2014 08:51:53 +0000 (08:51 +0000)]
tests: Add missing switch cases
This appeases GCC’s -Wswitch-enum warning, and makes it more obvious
that those enum cases have been explicitly considered, rather than just
forgotten about.
This introduces no functional changes.
Philip Withnall [Wed, 15 Jan 2014 08:51:28 +0000 (08:51 +0000)]
tests: Fix strict aliasing of sockaddr structures
Casting from one struct sockaddr type to another breaks C’s strict
aliasing rules (variables of different types cannot alias). Fix this
cleanly by using unions of struct sockaddrs to convert between the
types (i.e. type-punning).
I wish sockaddr didn’t have to be this painful.
See:
http://gcc.gnu.org/onlinedocs/gcc-4.4.1/gcc/Optimize-Options.html#Type_002dpunning
Olivier Crête [Sun, 19 Jan 2014 21:56:35 +0000 (16:56 -0500)]
stun: Make the MD5 code strict-aliasing correct
Philip Withnall [Fri, 3 Jan 2014 08:54:31 +0000 (08:54 +0000)]
build: Update .gitignore file
Olivier Crête [Wed, 8 Jan 2014 01:28:50 +0000 (20:28 -0500)]
pseudotcp: Add methods to query the state of the send and recv buffers
Olivier Crête [Fri, 3 Jan 2014 23:08:39 +0000 (18:08 -0500)]
pseudotcp: Implement window scaling for PseudoTCP.
Syncs with libjingle SVN rev 77
Olivier Crête [Mon, 6 Jan 2014 23:32:03 +0000 (18:32 -0500)]
tests: Add more asserts to pseudotcp test
Olivier Crête [Mon, 6 Jan 2014 23:31:46 +0000 (18:31 -0500)]
tests: Use right type when taking to stdio f*() C APIs
Olivier Crête [Mon, 6 Jan 2014 23:31:04 +0000 (18:31 -0500)]
tests: Close pseudosocket as soon as it's done sending
Olivier Crête [Fri, 3 Jan 2014 23:07:55 +0000 (18:07 -0500)]
tests: Fix racy destruction of pseudotcp object
Olivier Crête [Fri, 3 Jan 2014 23:07:34 +0000 (18:07 -0500)]
tests: No need to call adjust_clock in readable
This can only be called after we received a packet, where we already
adjust the clock
Olivier Crête [Fri, 3 Jan 2014 23:06:51 +0000 (18:06 -0500)]
tests: Use one struct for data and buffer
Olivier Crête [Fri, 3 Jan 2014 18:22:02 +0000 (13:22 -0500)]
pseudotcp: Only consolidate recv buffer if it's getting buffer
Should improve receive performance a bit.
Syncs with libjingle SVN rev 76
Olivier Crête [Fri, 3 Jan 2014 18:07:26 +0000 (13:07 -0500)]
pseudotcp: Make it possible to disable the Nagle Algorithm
Syncs with libjingle SVN rev 56
Olivier Crête [Fri, 31 Jan 2014 06:46:40 +0000 (01:46 -0500)]
agent: Don't make relayed sockets available in nice_agent_get_selected_socket()
Also document that fact.
Philip Withnall [Mon, 27 Jan 2014 09:33:51 +0000 (09:33 +0000)]
agent: Note that nice_agent_set_relay_info() can be called many times
Add to the documentation to note that it can be called several times to
set details for several relay servers during discovery.
Philip Withnall [Fri, 1 Nov 2013 10:34:43 +0000 (10:34 +0000)]
build: Don’t unconditionally enable -Werror for non-release builds
Do not unconditionally enable -Werror, since that breaks the build for
people who have stricter compilation warnings enabled.
Instead, add an --enable-compile-warnings configure flag which enables
-Werror when passed as --enable-compile-warnings=error. This mimics the
flag in gnome-common, for consistency. But we enable errors by default
on non-released versions.
Livio Madaro [Tue, 10 Dec 2013 11:18:03 +0000 (12:18 +0100)]
agent: Read all socket data in nice_agent_g_source_cb
Philip Withnall [Tue, 17 Dec 2013 10:05:17 +0000 (10:05 +0000)]
stun: Add printf function attribute
This shuts a compiler warning up and allows for format string checking
of debug messages.