Max Kellermann
5b82ffc291
include config.h in all sources
...
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.
2009-11-12 09:17:03 +01:00
Max Kellermann
b722d3d7f3
configure.ac: require GLib 2.12
...
Drop the required GLib version from 2.16 to 2.12, because many current
systems still don't have GLib 2.16. This requires several new
compatibility functions in glib_compat.h.
2009-11-10 21:14:22 +01:00
Max Kellermann
f66edccffd
fd_util: added O_NONBLOCK functions
...
Changed the wrappers for pipe(), socket(), accept(). On WIN32, this
does not work for pipe().
2009-11-08 22:11:35 +01:00
Max Kellermann
e3af0032b2
set the close-on-exec flag on all file descriptors
...
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.
2009-11-07 18:55:16 +01:00
Max Kellermann
308b3f2337
listen: handle fatal errors with GError
...
Don't call g_error(), which will abort the process and dump core.
2009-09-24 21:40:04 +02:00
Max Kellermann
d5ddecb15a
listen: bind() failure on secondary address is non-fatal
...
Several users had problems with binding MPD to "localhost". The cause
was duplicate /etc/hosts entries: the resolver library returns
127.0.0.1 twice, and of course, MPD attempts to bind to "both" of
them. This patch makes failures non-fatal, given that at least one
address was bound successfully. This is a workaround; users should
rather fix their /etc/hosts file.
2009-06-10 08:01:07 +02:00
Max Kellermann
5bb8a5eeef
listen: renamed "error" to "error_r" in listen_add_host()
2009-06-10 07:51:14 +02:00
Max Kellermann
7dec2a9bcb
listen: print debug message before bind()
...
Dump each socket address before binding to it.
2009-06-10 07:48:50 +02:00
Sean McNamara
b1e0bde529
Uniform getaddrinfo() on WIN32 or POSIX, because MinGW now supports it
2009-03-27 18:02:56 +01:00
Max Kellermann
c8c3920500
socket_util: added socket_bind_listen()
...
Moved code from listen_add_address() (listen.c) to socket_util.c.
2009-03-14 18:29:38 +01:00
Avuton Olrich
0aee49bdf8
all: Update copyright header.
...
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.
2009-03-13 11:51:55 -07:00
Max Kellermann
92db09fdf8
listen: return GError on "unix path too long"
...
When the unix domain socket path is too long, don't abort with
g_error().
2009-03-01 13:35:44 +01:00
Max Kellermann
f2664e329f
listen: removed unused macro BINDERROR()
2009-03-01 13:34:44 +01:00
Max Kellermann
c0e61687b6
listen: fix windows specific code
...
During the listen_add_host() API transition, the windows code wasn't
tested, and several removed arguments are still in use there.
2009-03-01 01:49:49 +01:00
Max Kellermann
1bb0124b77
listen: allocate sockaddr_storage struct for accept()
...
The generic sockaddr struct is too small for some addresses. For
accept(), we have to allocate a sockaddr_storage struct on the stack,
which is large enough for all addresses.
2009-02-28 15:20:35 +01:00
Max Kellermann
5c10d2ded7
client: use sockaddr_to_string()
...
Removed the sockaddr_to_tmp_string() hack, use
the new function sockaddr_to_string() instead.
2009-02-28 15:20:35 +01:00
Max Kellermann
1630fe00a2
listen: fix unused parameter warnings when TCP is disabled
...
Work around gcc warnings by casting the parameters to void.
2009-02-24 19:06:31 +01:00
Max Kellermann
d0a17ffb9d
listen: removed is_ipv6_enabled()
...
Don't explicitly check is_ipv6_enabled(), just try calling
listen_add_port_ipv6(), but check its error code.
2009-02-24 18:55:12 +01:00
Max Kellermann
adf044eb09
listen: splitted listen_add_port() into IPv4 and IPv6
...
Some more code simplification.
2009-02-24 18:49:09 +01:00
Max Kellermann
d40c439424
listen: don't call listen_add_config_param(NULL)
...
For default bind_to_address settings, don't call
listen_add_config_param(NULL), use listen_add_port() directly.
2009-02-24 18:36:31 +01:00
Max Kellermann
739c23cca5
listen: moved code to listen_add_host()
...
Split code from the rather large function listen_add_config_param(),
part 3.
2009-02-24 18:29:53 +01:00
Max Kellermann
33749e7ea9
listen: moved code to listen_add_path()
...
Split code from the rather large function listen_add_config_param(),
part 2.
2009-02-24 17:51:39 +01:00
Max Kellermann
36b1a860d3
listen: moved code to listen_add_port()
...
Split code from the rather large function listen_add_config_param().
2009-02-24 17:51:32 +01:00
Max Kellermann
dbb067c016
listen: listen_add_address() returns bool/GError
...
Don't return -1 on failure, and abort on fatal error - do proper error
reporting with GError, and return false on failure.
2009-02-24 17:43:10 +01:00
Max Kellermann
7de4e7228f
listen: removed unused macro "MAXHOSTNAME"
2009-02-24 17:42:37 +01:00
Max Kellermann
9bb3f2d060
listen: no CamelCase
...
Renamed functions.
2009-02-24 17:42:36 +01:00
Qball Cow
5484aaee5f
Set boundPort to the current portnumber, so zeroconf announces the right port number
2009-02-11 14:45:04 +01:00
Max Kellermann
5f77910097
conf: const pointers in block get functions
...
All config_get_block_*() functions should accept constant config_param
pointers.
2009-01-25 16:03:49 +01:00
Max Kellermann
2362ee4a48
use config_get_positive() instead of manual parsing
...
Simplify some code by using config_get_positive(), instead of doing
manual parsing and validation each time.
2009-01-21 08:48:02 +01:00
Max Kellermann
4d472c265e
conf: no CamelCase, part I
...
Renamed functions, types, variables.
2009-01-17 20:23:27 +01:00
Max Kellermann
2a7d99702f
listen: explicitly include sys/socket.h
2009-01-16 17:11:18 +01:00
Max Kellermann
5232f05470
listen: don't compile ipv6Supported() if !HAVE_IPV6
...
The function ipv6Supported() is not used at all when IPv6 support was
disabled at compile time.
2009-01-15 08:33:32 +01:00
Max Kellermann
ca5432a79b
listen: remove the socket source from the main context
...
Free memory before exiting.
2009-01-10 18:55:33 +01:00
Max Kellermann
d60cf67d19
listen: added struct listen_socket
...
Make the listen socket an object, allowing us to add more fields
later. Convert listenSockets into a simple linked list.
2009-01-10 18:55:29 +01:00
Max Kellermann
8ebb3196a8
listen: use GLib instead of utils.h
2009-01-03 14:51:43 +01:00
Max Kellermann
2bc0144023
client: use GLib instead of utils.h
2009-01-03 13:44:19 +01:00
Max Kellermann
019bca2475
listen: use gethostbyname() on WIN32
...
WIN32 has no getaddrinfo(). Fall back to gethostbyname().
2009-01-03 13:23:03 +01:00
Max Kellermann
71e7ce5d8e
main: use the GLib main loop
...
This is a rather huge patch, which unfortunately cannot be splitted.
Instead of using our custom ioops.h library, convert everything to use
the GLib main loop.
2008-12-30 19:24:39 +01:00
Max Kellermann
1f0804bdca
listen: don't make the server socket non-blocking
...
There is no point in making the server socket non-blocking. We call
accept() only after select() has notified us about a new connection.
2008-12-30 19:18:59 +01:00
Max Kellermann
2eaeb65666
listen: include winsock headers on WIN32
...
On Windows, socket declarations reside in winsock.h and ws2tcpip.h.
The POSIX headers are not available.
2008-12-30 19:07:10 +01:00
Max Kellermann
6c0f5fc612
listen: moved redirect_stdin() to daemon.c
...
redirect_stdin() is a daemonization function, and disconnecting from
the standard input is always a good idea for MPD.
2008-12-30 16:28:13 +01:00
Max Kellermann
d99595c214
listen: eliminated freeAllListenSockets()
...
Merged freeAllListenSockets() into closeAllListenSockets(), because
this is its only caller.
2008-12-30 16:28:00 +01:00
Max Kellermann
0a9f69eaaa
listen: use GLib logging
2008-12-29 17:29:04 +01:00
Max Kellermann
95b3430f52
removed os_compat.h
...
Only include headers which are really needed. os_compat.h aimed to
make MPD easily portable, but was never actually made portable.
2008-12-29 17:28:32 +01:00
Max Kellermann
4716ef1014
listen: "port" argument is unused when TCP support is disabled
...
Add a G_GNUC_UNUSED attribute.
2008-12-24 11:07:58 +01:00
Max Kellermann
6902ff2084
listen: check if AI_ADDRCONFIG is defined
...
AI_ADDRCONFIG is not available on all operating systems. Check if it
is defined in the current build environment.
2008-12-02 10:23:36 +01:00
Max Kellermann
ac0af91912
listen: enable AI_PASSIVE
...
The getaddrinfo() flag AI_PASSIVE should be used when resolving
addresses for the bind() system call.
2008-12-02 10:22:21 +01:00
Tom Servo
ea92576219
listen: fix namespace collision on OpenSolaris
...
The listen.c module breaks the build because the variable name used
("sun") for the Unix domain socket part collides with something else
on an OpenSolaris system, likely Sun specific. Renaming it to _sun
(or something else of choice) fixes the build.
[mk: renamed to "s_un"]
2008-11-07 10:33:48 +01:00
Max Kellermann
4d72bda4c3
listen: set file mode 666 on the unix socket
...
Depending on MPD's umask, the file permissions of the unix socket were
too restrictive, and many clients were not able to connect. Do a
chmod(0666) on the socket, to allow everybody to connect.
2008-10-30 18:03:18 +01:00
Andrzej Rybczak
52123c1de8
listen: fix "struct ucred" check
...
The macro name is HAVE_STRUCT_UCRED, not HAVE_UCRED.
2008-10-18 18:21:49 +02:00