Commit Graph

3614 Commits

Author SHA1 Message Date
Laszlo Ashin
a12b57e1e9 ls.c: include config.h to have HAVE_CURL here 2008-12-31 13:00:33 +01:00
Max Kellermann
dd0f8e42f3 main_notify: removed lock()/unlock()
These functions are not used anymore since we use the GLib main loop.
2008-12-31 00:32:56 +01:00
Max Kellermann
2cdfd93830 client: remember GLib source id
Remove the event source from the GMainLoop object in
client_set_expired().
2008-12-31 00:29:27 +01:00
Max Kellermann
d196ffdf3a sig_handlers: call g_main_loop_quit() in SIGTERM handler
We don't need to use asynchronous events to quit MPD, we can just call
g_main_loop_quit() inside the handler.
2008-12-30 19:50:38 +01:00
Max Kellermann
d40cf1652d main: export the main_loop variable
Other libraries may need to access the main_loop reference, to add or
remove events, or to call g_main_loop_quit().
2008-12-30 19:50:22 +01:00
Max Kellermann
a3b0506cfd sig_handlers: removed SIGCHLD
We have no child processes anymore.  Remove the SIGCHLD handler.
2008-12-30 19:35:01 +01:00
Max Kellermann
f38aaa2bb7 sig_handlers: don't reload database on SIGHUP
The SIGHUP handler was used by the update process to make the main
process re-read the database.  We don't need this anymore, since the
update takes place in a thread now.
2008-12-30 19:34:05 +01:00
Max Kellermann
a1434914a7 sig_handlers: removed unused functions
Most of these functions were obsoleted when we switched to threaded
MPD.
2008-12-30 19:32:12 +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
03e650aa9e main_notify: make the read side of the pipe blocking
Currently, both sides of the pipe are blocking, although we do not
need blocking read().  Convert it back to blocking.  Eliminate the
select() from wait_main_task().
2008-12-30 19:20:36 +01:00
Max Kellermann
10b5966bf6 main_notify: removed notify object, use only pipe
To wake up the main thread, don't attempt to use a GCond/GMutex
(struct notify).  This kind of mixed wakeup method has known race
conditions.

The idea behind this patch is: for wakeups which happen while the main
thread is sleeping, use only a pipe.  For wakeups which happen while
the main thread is waiting for the player thread, we can later change
to GCond.  For now, accept the overhead of using a pipe for the
latter.

In the long run, the main thread will never wait for the player
thread, but will do everything asynchronously.
2008-12-30 19:20:20 +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
6890183c50 utils: port set_nonblocking() to WIN32
The new WIN32 version of set_nonblocking() can only deal with sockets,
i.e. it will fail on main_notify.c.  On WIN32, we have to reimplement
main_notify.c anyway, so this is not a big deal.
2008-12-30 19:17:20 +01:00
Max Kellermann
bb55ec6b4e command: don't allow adding local files on WIN32
There are no unix sockets on WIN32, and therefore no authentication.
WIN32 might have similar capabilities, but until we implement them,
disable that MPD feature.
2008-12-30 19:14:13 +01:00
Max Kellermann
7330002960 utils: implement my_usleep() with Sleep() on WIN32
Sleep() has only millisecond granularity, but good enough for now.
2008-12-30 19:10:08 +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
e888af98a2 bonjour: fixed "unused parameter" warnings
Add G_GNUC_UNUSED attributes.
2008-12-30 16:45:49 +01:00
Max Kellermann
13867a1e7c zeroconf: eliminated strlen() usage from initZeroconf()
To test if a string is empty, we can just see if the first byte is 0.
No need to include string.h for strlen() here.
2008-12-30 16:45:43 +01:00
Max Kellermann
49fa9708d5 zeroconf: moved code to zeroconf-avahi.c and zeroconf-bonjour.c
Moved implementation specific code to their own sources, internal
declarations in zeroconf-internal.h.
2008-12-30 16:43:58 +01:00
Max Kellermann
bbed35822e zeroconf: fail if avahi service name is invalid
If the configured avahi service name is invalid, abort MPD.  Don't
fall back to the default service name.
2008-12-30 16:43:58 +01:00
Max Kellermann
e9a3c4ce32 playlist: use GLib's random number generator
srandom() and random() are not portable.  Use GLib's implementation.
2008-12-30 16:34:32 +01:00
Max Kellermann
cdf1eaeb2c daemon: simplified daemonize_close_stdin()
Don't bother to call fstat() or isatty() on STDIN_FILENO.
2008-12-30 16:28:18 +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
671480814c main: moved daemonize() to daemon.c 2008-12-30 16:28:07 +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
Viliam Mateicka
4cc0caf1af print supported decoders in --version 2008-12-30 14:17:15 +01:00
Max Kellermann
d38a7967ab main: disable non-portable code on WIN32
Disable changeToUser(), daemonize(), killFromPidFile().
2008-12-29 17:43:00 +01:00
Max Kellermann
509d12ae88 utils: implement parsePath() with g_strdup() on WIN32
On WIN32, parsePath() now simply duplicates the input string.  There
is currently nothing special we can do here.  The old code was not
portable on WIN32.
2008-12-29 17:42:54 +01:00
Max Kellermann
d4638834f8 utils: use g_get_home_dir()
Use g_get_home_dir() to get the home directory of the current user.
This will be portable to win32.
2008-12-29 17:42:49 +01:00
Max Kellermann
db849d1eed utils: make variables more local in parsePath()
Declare variables where they are really used.
2008-12-29 17:42:46 +01:00
Max Kellermann
3c9992aead client: include winsock headers on WIN32
On Windows, socket declarations reside in winsock.h and ws2tcpip.h.
The POSIX headers sys/socket.h etc. are not available.
2008-12-29 17:42:43 +01:00
Max Kellermann
274b919966 main: use g_setenv() instead of setenv()
Removed the fallback setenv() implementation for solaris.
2008-12-29 17:37:40 +01:00
Max Kellermann
6517126204 log: removed unused logging wrappers
Removed GLib logging wrappers which are not used anymore.
2008-12-29 17:35:42 +01:00
Max Kellermann
91be85a307 main: use GLib logging 2008-12-29 17:35:40 +01:00
Max Kellermann
4d3dd1ed2a path: use GLib logging 2008-12-29 17:32:53 +01:00
Max Kellermann
29500cedff update: use GLib logging 2008-12-29 17:29:49 +01:00
Max Kellermann
ef308d9644 alsa: use GLib logging 2008-12-29 17:29:42 +01:00
Max Kellermann
74d4ec7fbb jack: use GLib logging 2008-12-29 17:29:36 +01:00
Max Kellermann
eddf5e1e5e fifo: use GLib logging 2008-12-29 17:29:31 +01:00
Max Kellermann
409ee38b42 state_file: use GLib logging 2008-12-29 17:29:23 +01:00
Max Kellermann
d4018c9966 volume: use GLib logging 2008-12-29 17:29:18 +01:00
Max Kellermann
e9b96c6e56 player_thread: use GLib logging 2008-12-29 17:29:14 +01:00
Max Kellermann
46bef03e5a tag_id3: use GLib logging 2008-12-29 17:29:10 +01:00
Max Kellermann
0a9f69eaaa listen: use GLib logging 2008-12-29 17:29:04 +01:00
Max Kellermann
d6170c30c8 utils: use GLib logging 2008-12-29 17:29:01 +01:00
Max Kellermann
173021e4eb client: use GLib logging 2008-12-29 17:28:56 +01:00
Max Kellermann
e0fe4eb722 pcm: use GLib logging 2008-12-29 17:28:49 +01:00
Max Kellermann
f4ce43b958 database: use GLib logging 2008-12-29 17:28:37 +01:00
Max Kellermann
3fa5632704 log: automatically append newline
If a log message does not include a newline character, append it.
2008-12-29 17:28:34 +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