summaryrefslogtreecommitdiff
path: root/socket/tcp-bsd.c
Commit message (Collapse)AuthorAgeFilesLines
* tcp-bsd: Handle send before connect() completesOle André Vadla Ravnås2021-05-101-0/+1
|
* conncheck: refactor local and remote candidates validationFabrice Bellet2020-03-021-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | The same code to get and validate local and remote candidates from an incoming stun is shared between regular inbound stun, early checks replay, and partially in the local peer-reflexive discovery function. The selection of the matching local and remote candidate from an incoming stun sometimes requires more information than just the local socket, and the sender address and port. It happens more frequently when the port range is reduced, and when the conncheck handles both tcp and udp candidates. To help to disambiguate such situations, we add supplementary checks when two candidates in the list have the same address and and port number: * the type of the socket must compatible with the candidate transport. A socket for a tcp candidate may be active of passive, but also of type "tcp-bsd" when the parent active or passive socket is replaced after a bind() or accept(). It gives several cases. * the remote candidate transport and the local candidate transport must be compatible
* tcp-bsd: fix a heap-use-after-freeFabrice Bellet2019-07-041-1/+3
|
* Fix build with MSVCNirbheek Chauhan2018-12-141-0/+1
| | | | Tested inside Cerbero with VS 2017
* tcp-passive: Clear connection on child closingOlivier Crête2018-11-211-0/+17
| | | | | | | If this isn't done, then there may be invalid points left inside the passive socket which could be used and cause a crash. Fixes #33
* tcp-bsd: Restore global locksJakub Adam2018-11-201-7/+9
| | | | | | | | Avoids race between socket_send_more() and socket_close() leading either to crash on use of freed NiceSocket, or abort upon attempting to g_mutex_clear() a locked mutex. Akin to what d1611c0c0ba6c5bce500b96a8f61de4fe5f144e9 did to udp-turn.
* Use per-agent locks and GWeakRefs in callbacks from timeout sourcesJuan Navarro2018-10-281-4/+8
| | | | | | | | | | | | | | | | | | | | | Work on libnice's bug #1 in Gitlab. This work is composed of multiple merged parts: - "Global lock contention removed" Phabricator D1900: https://phabricator.freedesktop.org/D1900 By @nifigase Opened in GitLab as Merge Request !12 - "agent: properly handle NiceAgent ref in callbacks from timeout sources" Phabricator D1898: https://phabricator.freedesktop.org/D1898 By @mparis This patch was itself based upon a previous version of the work done in D1900. After the switch of hosting, it got lost. On top of these, additions to follow some review comments from @ocrete: - https://phabricator.freedesktop.org/D1900#40412 - https://phabricator.freedesktop.org/D1898#39332
* Fix cast-function-type warning introduced in GCC 8Nicolas Dufresne2018-06-121-3/+3
| | | | | | This is new warning introduced with GCC 8. This is being fixed by using appropriate function, like g_queue_free_full/g_list_free_full or by casting to GCallback before casting to the target function signature. Closes: #46
* socket: Assert trying to use free'd socketOlivier Crête2016-06-021-9/+6
| | | | | Cleanly returnign makes no sense and may hide worse problems.
* Creating TCP sockets with TCP_NODELAY option set to TRUEPhilip Withnall2015-08-291-0/+8
| | | | | | | | | | | | | | | | | | Disable Nagling for underlying TCP sockets used by libnice, because they are typically used for streaming applications, or for pseudo-TCP; the bandwidth in both cases is harmed by Nagling. Based on a patch by Vadim Genkin. Maniphest Tasks: T3317 Reviewers: pwithnall Projects: #libnice Subscribers: pwithnall, vadimgenkin Differential Revision: https://phabricator.freedesktop.org/D230
* socket: Return early from socket functions if the socket is closedPhilip Withnall2014-09-021-0/+12
| | | | | | | | Explicitly check whether the socket is closed (universally represented as sock->priv == NULL) before doing anything else in the socket methods. This should safely return from unusual situations where the socket has been closed and part-destroyed but still ends up having send() or recv() called on it.
* socket: Remove dead codePhilip Withnall2014-08-141-3/+0
| | | | | | | At that point, (len > 0), since there are conditions above handling the (len == 0) and (len < 0) cases, both of which break from the loop. Coverity issue: #29325
* Add a nice_socket_can_send and nice_socket_set_writable_callback APIsYouness Alaoui2014-05-171-6/+29
|
* Change argument names for tcp-bsdYouness Alaoui2014-05-171-2/+2
|
* Set local address of TCP-BSD socketJakub Adam2014-05-171-8/+7
|
* nice_tcp_bsd_socket_new: rename addr -> remote_addrJakub Adam2014-05-171-4/+4
|
* Refactor tcp-bsd to ease integration of tcp-act/tcp-passiveYouness Alaoui2014-05-151-26/+38
|
* Factor out the add_to_be_sent into a helper API for socketsYouness Alaoui2014-05-151-119/+16
| | | | | | The add_to_be_sent was duplicated in http/socks5/pseudossl/tcp-bsd and had some small differences. It's better to factor it out so bug fixes get applied to all of them and code is cleaner.
* Do not allow message_offset to become negative when queuing messagesYouness Alaoui2014-05-151-1/+4
|
* Add a nice_socket_send_reliable API for internal use.Youness Alaoui2014-05-151-28/+30
| | | | | | | | | | | | | | One issue with tcp-bsd is that it will queue messages when the tcp socket is not writable, but it will also drop messages when the queue is full. If we want to do proper reliable ice-tcp, we need to make sure that messages don't get dropped, also, this would affect http/socks5/pseudossl if their messages get dropped. For ice-tcp, when the socket is not writable we want to return 0, not queue the message. The change here is to allow connchecks and other important protocol messages to be sent as 'reliable' on tcp transports by queuing them and in the various socket layers and to never drop them, but all user messages will be dropped. if the tcp socket is not writable.
* Return number of sent messages in socket_send_messages when an error happens ↵Youness Alaoui2014-05-151-0/+2
| | | | part-way
* Allow tcp-bsd to act as reliable or non reliable transport and fix ↵Youness Alaoui2014-05-151-2/+9
| | | | is_reliable on other sockets
* Add a socket type for socket layerYouness Alaoui2014-05-151-0/+1
|
* tcp-bsd: Don't clear error that hasn't been setOlivier Crête2014-04-081-3/+2
|
* Small cleaning of tcp-bsd.cYouness Alaoui2014-04-041-19/+21
|
* tcp-bsd: Use default main context if none specifiedOlivier Crête2014-03-271-0/+2
|
* Remove the "length" parameter from NiceOutputMessageOlivier Crête2014-01-311-17/+22
| | | | It was used correctly only half the time anyway
* Remove the "to" parameter from NiceOutputMessageOlivier Crête2014-01-311-9/+5
| | | | | We never send multiple messages to separate targets in practice, so this will simplify the code
* socket: Add note that the packet dropping in tcp-bsd is broken behaviorOlivier Crête2014-01-311-0/+3
|
* socket: Add vectored I/O support for sending on socketsPhilip Withnall2014-01-311-49/+113
| | | | | | | | | | | | | | | | | 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.
* socket: Add vectored I/O support for receiving on socketsPhilip Withnall2014-01-311-21/+39
| | | | | | | | | | | | 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.
* Fix strict aliasing of sockaddr structuresPhilip Withnall2013-12-181-11/+14
| | | | | | | | | | | | 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
* Fix tcp-bsd/udp-bsd coding style, add robustness and remove use of name_lenYouness Alaoui2012-03-011-32/+21
|
* Callback now takes a GSocket * as argumentYouness Alaoui2012-03-011-2/+2
|
* Fix coding styleYouness Alaoui2012-03-011-24/+27
|
* Replace sockets with GSocketLivio Madaro2012-03-011-79/+73
| | | | Use GSocket for better Windows compatibility
* set nonblocking mode for socket on WindowsLivio Madaro2012-02-231-2/+8
|
* Use g_io_channel_win32_new_socket for windowsFilippo Della Betta2012-02-151-0/+4
| | | | | | As glib documentation suggests (http://developer.gnome.org/glib/2.28/glib-IO-Channels.html), g_io_channel_unix_new should be avoided on WIN32 platform. Replaced with g_io_channel_win32_new_socket function
* Merge branch 'master' of ssh://dhansak/srv/git.collabora.co.uk/git/libniceYouness Alaoui2012-02-081-4/+5
|\ | | | | | | | | Conflicts: configure.ac
| * Don't pass the agent to the socket layerOlivier Crête2011-09-201-3/+1
| |
| * Keep a ref on the GMainContext that are attached toOlivier Crête2011-09-201-1/+4
| |
* | Add support for windows's compilation through MinGWNader Morshed2011-11-301-1/+1
|/
* Fix a crash (Broken pipe) if we send to a TCP socket that had an errorYouness Alaoui2011-01-181-1/+14
|
* Merge remote branch 'tester/misc-fixes' into nice-kakarotoYouness Alaoui2010-07-201-1/+3
|\ | | | | | | | | Conflicts: agent/agent.c
| * tcp-bsd: Fix possible leakOlivier Crête2010-05-211-1/+3
| |
* | tcp-bsd: Create IPv6 socket if it such an addressOlivier Crête2010-06-271-6/+12
|/
* Fix copyright headers for all filesYouness Alaoui2010-02-161-9/+4
|
* do not try to connect a tcp socket with no destination address to connect ↵Youness Alaoui2009-12-291-5/+5
| | | | to. Fixes coverity check when dereferencing addr
* Use a global mutex for all nice agents and use g_source_is_destroyed to ↵Youness Alaoui2009-06-161-3/+10
| | | | avoid the race condition of a source being destroyed while we wait for the mutex
* Add support for droping packets when using TCP and the bandwidth is too slow ↵Youness Alaoui2009-06-111-3/+22
| | | | for the data output. The queue now has a limit of 20 packets and the tcp-turn now has to call send in a single shot to avoid dropping parts of the packet (dropping the length but send the data, or dropping only the padding at the end, etc..)