- 31 Jan, 2014 34 commits
-
-
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’.
-
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.
-
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.
-
Mostly problems with the specifier for gsize.
-
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.
-
-
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).
-
Add ‘_locked’ to the name to clarify that it must be called with the agent’s lock already held.
-
…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.
-
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.
-
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.
-
Move all functionality which is unrelated to the GSource into _nice_agent_recv().
-
This is emitted when one or more streams are removed from the agent due to a call to nice_agent_remove_stream().
-
A g_usleep() was introduced in commit e22ecb19 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).
-
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.
-
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.
-
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.
-
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.
-
GCC warns about this. Might as well prevent the warning.
-
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.
-
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 authored
-
-
Olivier Crête authored
-
Olivier Crête authored
Syncs with libjingle SVN rev 77
-
Olivier Crête authored
-
Olivier Crête authored
-
Olivier Crête authored
-
Olivier Crête authored
-
Olivier Crête authored
This can only be called after we received a packet, where we already adjust the clock
-
Olivier Crête authored
-
Olivier Crête authored
Should improve receive performance a bit. Syncs with libjingle SVN rev 76
-
Olivier Crête authored
Syncs with libjingle SVN rev 56
-
Olivier Crête authored
Also document that fact.
-
- 27 Jan, 2014 1 commit
-
-
Philip Withnall authored
Add to the documentation to note that it can be called several times to set details for several relay servers during discovery.
-
- 07 Jan, 2014 2 commits
-
-
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.
-
-
- 02 Jan, 2014 3 commits
-
-
This shuts a compiler warning up and allows for format string checking of debug messages.
-
This fix may not be entirely cross-platform, and I have been unable to test whether it is; making it cross-platform is made more difficult by the fact that the STUN code doesn’t use GLib. The PRIuPTR macro was defined in POSIX:2004, and later in C99. http://pubs.opengroup.org/onlinepubs/009696799/basedefs/inttypes.h.html
-
-