aboutsummaryrefslogtreecommitdiffstats
path: root/src/socket_util.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* DatabaseVisitor, ...: use GError forward declarationMax Kellermann2012-08-021-0/+2
|
* don't define WINVER in *.c filesMax Kellermann2011-10-091-1/+0
| | | | | In a C file, that is too late, because _mingw.h defaults to 0x0502, and ours would be illegal redefintion.
* Simplify setsockopt() casting workaroundDan McGee2011-09-211-18/+4
| | | | | | | | | On Win32, the third setsockopt parameter has type (char *) while on POSIX systems it is (void *). However, given that it is a no-op cast to go from a char pointer to a void pointer, we can cast to a char pointer (with a possible const modifier) on all platforms and satisfy the compiler. Signed-off-by: Dan McGee <dan@archlinux.org>
* socket_util: move sockaddr_to_string() to resolver.cMax Kellermann2011-09-201-50/+0
|
* Merge branch 'v0.16.x'Max Kellermann2011-09-201-3/+3
|\
| * fd_util: add function close_socket()Max Kellermann2011-09-201-3/+3
| | | | | | | | Wrap close(), use closesocket() on WIN32/WinSock.
* | Set socket TCP keepalive option on incoming connectionsDan McGee2011-09-191-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a connected host disappears without our knowledge, as can happen over wireless or a hibernating machine, we continue to hold the port open waiting for messages. Because we never try to send anything down this now-broken pipe, the connection will sit idle taking up a slot in our allowed incoming connections list. If enough of these happen, an unintended Denial of Service takes place, where all connection slots are filled with now-broken, never ending connections. Setting the TCP keepalive option at least allows these to time out after the default two hours, which is sufficient in the non-malicious case. Signed-off-by: Dan McGee <dan@archlinux.org>
* | copyright year 2011Max Kellermann2011-01-291-1/+1
|/
* socket_util: fix setsockopt() argument type on WIN32Max Kellermann2010-05-181-1/+7
| | | | | In the winsock headers, the setsockopt() argument is declared as "const char *", not "const void *".
* Define winnt or greater on mingw32 to take advantage of get*info().Avuton Olrich2010-03-211-0/+1
|
* Update copyright notices.Avuton Olrich2009-12-311-1/+1
|
* include config.h in all sourcesMax Kellermann2009-11-121-1/+1
| | | | | | After we've been hit by Large File Support problems several times in the past week (which only occur on 32 bit platforms, which I don't have), this is yet another attempt to fix the issue.
* fd_util: added O_NONBLOCK functionsMax Kellermann2009-11-081-1/+1
| | | | | Changed the wrappers for pipe(), socket(), accept(). On WIN32, this does not work for pipe().
* set the close-on-exec flag on all file descriptorsMax Kellermann2009-11-071-1/+2
| | | | | | | | | | | Added the "fd_util" library, which attempts to use the new thread-safe Linux system calls pipe2(), accept4() and the options O_CLOEXEC, SOCK_CLOEXEC. Without these, it falls back to FD_CLOEXEC, which is not thread safe. This is particularly important for the "pipe" output plugin (and others, such as JACK/PulseAudio), because we were heavily leaking file descriptors to child processes.
* socket_util: fixed format warningMax Kellermann2009-04-011-1/+1
| | | | | g_set_error() is a printf-like function, and expects a format string. Using the return value of gai_strerror() is unsafe.
* socket_util: use g_strerror() instead of strerror()Max Kellermann2009-03-161-1/+1
| | | | | g_strerror() is more portable, and guarantees that the returned string is UTF-8 encoded.
* socket_util: added socket_bind_listen()Max Kellermann2009-03-141-0/+61
| | | | Moved code from listen_add_address() (listen.c) to socket_util.c.
* all: Update copyright header.Avuton Olrich2009-03-131-3/+4
| | | | | | | | This updates the copyright header to all be the same, which is pretty much an update of where to mail request for a copy of the GPL and the years of the MPD project. This also puts all committers under 'The Music Player Project' umbrella. These entries should go individually in the AUTHORS file, for consistancy.
* socket_util: check if IN6_IS_ADDR_V4MAPPED is definedMax Kellermann2009-03-061-2/+2
| | | | | On some systems, the macro IN6_IS_ADDR_V4MAPPED() is not available. Don't try to convert IPv6 to their IPV4 equivalents in this case.
* socket_util: include ws2tcpip.h for getnameinfo()Max Kellermann2009-03-011-0/+4
| | | | Windows doesn't have the standard headers sys/socket.h and netdb.h.
* socket_util: unpack V4MAPPED addressesMax Kellermann2009-02-281-0/+20
| | | | | Unpack IPv4 addresses which are packed inside an IPv6 address, i.e. return "127.0.0.1" rather than "::ffff:127.0.0.1".
* socket_util: added function sockaddr_to_string()Max Kellermann2009-02-281-0/+56
Create the socket_util.c library, the first function is sockaddr_to_string(): it converts a sockaddr struct to a string containing the IP address in a human-readable form.