summaryrefslogtreecommitdiff
path: root/socket/udp-bsd.c
Commit message (Collapse)AuthorAgeFilesLines
* udp-bsd: Protect the GSocketAddress cache with a mutexlock-addr-cache-in-udp-sinkOlivier Crête2018-11-161-8/+22
|
* udp-bsd: Log g_socket_send_message() errorsJakub Adam2017-04-031-1/+6
| | | | | | | Those may have previously been silently ignored. Reviewed-by: Philip Withnall <philip.withnall@collabora.co.uk> Differential Revision: https://phabricator.freedesktop.org/D1708
* socket: Assert trying to use free'd socketOlivier Crête2016-06-021-9/+6
| | | | | Cleanly returnign makes no sense and may hide worse problems.
* socket: Handle ECONNRESET as EWOULDBLOCK on WindowsPhilip Withnall2015-08-181-1/+4
| | | | | | | | | Some versions of Windows can return ECONNRESET for UDP recvmsg() calls if they would otherwise block. Hence, handle the two equivalently; this should not affect behaviour on Linux, which apparently does not return ECONNRESET for UDP recvmsg() calls at all. https://phabricator.freedesktop.org/T121
* socket: Return early from socket functions if the socket is closedPhilip Withnall2014-09-021-0/+8
| | | | | | | | 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: Gracefully return from send() if the socket is closedPhilip Withnall2014-08-211-0/+4
|
* Add a nice_socket_can_send and nice_socket_set_writable_callback APIsYouness Alaoui2014-05-171-0/+17
|
* Add a nice_socket_send_reliable API for internal use.Youness Alaoui2014-05-151-0/+10
| | | | | | | | | | | | | | 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
* Add a socket type for socket layerYouness Alaoui2014-05-151-0/+1
|
* Remove the "to" parameter from NiceOutputMessageOlivier Crête2014-01-311-10/+9
| | | | | We never send multiple messages to separate targets in practice, so this will simplify the code
* socket: Add vectored I/O support for sending on socketsPhilip Withnall2014-01-311-12/+49
| | | | | | | | | | | | | | | | | 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-29/+53
| | | | | | | | | | | | 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.
* socket: Ensure variables are nullified correctly in UDP socketsPhilip Withnall2014-01-311-1/+2
| | | | | | | | | 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.
* Fix strict aliasing of sockaddr structuresPhilip Withnall2013-12-181-18/+27
| | | | | | | | | | | | 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 gaddr initializationLivio Madaro2012-08-031-2/+2
|
* Cache GSocketAddress in UdpBsdSocketOlivier Crête2012-05-281-9/+33
| | | | | Creating a GSocketAddress takes a measurable amount of time, so let's cache it as it doesn't change once a socket is created.
* Fix tcp-bsd/udp-bsd coding style, add robustness and remove use of name_lenYouness Alaoui2012-03-011-17/+14
|
* Fix memory leak with udp-bsdYouness Alaoui2012-03-011-11/+12
|
* Fix coding styleYouness Alaoui2012-03-011-19/+19
|
* Replace sockets with GSocketLivio Madaro2012-03-011-52/+54
| | | | Use GSocket for better Windows compatibility
* set nonblocking mode for socket on WindowsLivio Madaro2012-02-231-0/+5
|
* udp-bsd: Do not return an error for CONNRESET errors from ICMPMadaro Livio2012-02-131-1/+2
| | | | | | | | | | | I have a use case where len < 0 but the socket is still working. It is when the stun server is not listening and the client receives ICMP messages. I think it is a Windows specific problem. Calling WSAGetLastError() returns WSAECONNRESET. The MSDN documentation sais: "On a UDP-datagram socket, this error would indicate that a previous send operation resulted in an ICMP "Port Unreachable" message." http://msdn.microsoft.com/en-us/library/windows/desktop/ms740121(v=vs.85).aspx
* Add support for windows's compilation through MinGWNader Morshed2011-11-301-3/+1
|
* Merge remote branch 'tester/misc-fixes' into nice-kakarotoYouness Alaoui2010-07-201-4/+0
|\ | | | | | | | | Conflicts: agent/agent.c
| * udp-bsd: Remove useless check from nice_udp_bsd_socket_newOlivier Crête2010-05-211-4/+0
| |
* | udp-bsd: Create IPv6 socket if it such an addressOlivier Crête2010-06-271-0/+6
|/
* Fix copyright headers for all filesYouness Alaoui2010-02-161-5/+4
|
* Even for UDP sockets, we should handle EAGAIN errors because it can happen.. ↵Youness Alaoui2009-11-101-0/+9
| | | | Apparently recvfrom can return EAGAIN on udp sockets if for example there's a bad checksum in the packet or some other similar error
* Socket layer refactorising and adding of tcp-bsd, pseudossl, and moved the ↵Youness Alaoui2008-12-081-137/+68
| | | | tcp stuff from tcp-turn and made udp-turn into turn since it's generic
* fix udp-turn closesocket for windows. use sockfd since sock->fileno is not ↵Youness Alaoui2008-11-191-2/+2
| | | | yet set
* Use the correct size for sockaddr_storage, otherwise it won't work on mac os ↵Youness Alaoui2008-11-171-4/+9
| | | | x. Also use some cleaner code
* replace close by closesocket for windowsYouness Alaoui2008-11-031-0/+16
|
* Fix includes for win32 compilationYouness Alaoui2008-11-031-1/+6
|
* use socklen_t where needed, and cast it to size_t as it defined as an int in ↵Youness Alaoui2008-10-281-2/+2
| | | | mingw and as an uint on linux systems
* remove unnecessary inclusion of socket files in some files, and make glib ↵Youness Alaoui2008-10-281-1/+0
| | | | included before stdlib.h because it redefines atexit
* Add nice_socket_is_reliable to the APIYouness Alaoui2008-10-081-0/+7
|
* port test-bsd to the new APIYouness Alaoui2008-10-071-1/+0
|
* Much better NiceSocket API now, no more need for a socket factoryYouness Alaoui2008-10-071-38/+22
|
* Update udp socket layers to new NiceSocket APIYouness Alaoui2008-10-061-9/+9
|
* Renaming udp directory to socketYouness Alaoui2008-10-061-0/+244