Commit Graph

5883 Commits

Author SHA1 Message Date
Jonathan Neuschäfer
371c82b2bf utils: mark sockaddr_to_string() as G_GNUC_MALLOC 2011-09-21 17:56:06 +02:00
Dan McGee
8176880173 Simplify setsockopt() casting workaround
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>
2011-09-21 17:54:44 +02:00
Max Kellermann
533a6b0240 tcp_connect: generic library for establishing TCP connections 2011-09-20 21:27:17 +02:00
Max Kellermann
0c0400b6fc io_thread: add function _timeout_add()
Same as _timeout_add_seconds(), but this one has millisecond
resolution.
2011-09-20 21:27:17 +02:00
Max Kellermann
2e83af7c21 io_thread: _timeout_add_seconds() returns GSource*
The numeric ID isn't so useful.
2011-09-20 21:26:30 +02:00
Max Kellermann
a3f7947ad2 server_socket: use resolve_host_port() instead of getaddrinfo()
Allow port specification in "bind_to_address" settings.
2011-09-20 21:15:22 +02:00
Max Kellermann
7d9d459ac2 resolver: add function resolve_host_port() 2011-09-20 21:15:05 +02:00
Max Kellermann
3ea1073809 socket_util: move sockaddr_to_string() to resolver.c 2011-09-20 08:49:36 +02:00
Max Kellermann
76a959a578 rtsp_client, output/raop: use close_socket() instead of close() 2011-09-20 08:48:48 +02:00
Max Kellermann
f43873dc5f tcp_socket, udp_server: use g_io_channel_new_socket() 2011-09-20 08:47:42 +02:00
Max Kellermann
921553d7bb Merge branch 'v0.16.x' 2011-09-20 08:47:06 +02:00
Max Kellermann
c476819cb1 fd_util: add function close_socket()
Wrap close(), use closesocket() on WIN32/WinSock.
2011-09-20 08:38:58 +02:00
Max Kellermann
77a56c7c5a fd_util: check HAVE_INOTIFY_INIT in header
Don't provide the prototype if inotify_init() was not detected.
2011-09-20 08:38:17 +02:00
Max Kellermann
46deb7ca82 fd_util: include check.h, verify config.h was included 2011-09-20 08:38:08 +02:00
Max Kellermann
b03f9ece05 glib_socket.h: wrap g_io_channel_*_new() calls portably
The server_socket library (used by the httpd output plugin) didn't
check for WIN32, that's fixed now.
2011-09-20 08:35:25 +02:00
Dan McGee
27946a981f Set socket TCP keepalive option on incoming connections
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>
2011-09-19 17:11:09 +02:00
Max Kellermann
74617389c8 output_plugin: the plugin allocates the audio_output object
Pass audio_output objects around instead of void pointers.  This will
give some more control to the plugin, and prepares for non-blocking
audio outputs.
2011-09-19 09:41:21 +02:00
Max Kellermann
1d8840412f configure.ac: add option --enable-solaris-output
Allow enabling the plugin explicitly without running Solaris, to test
the build.
2011-09-19 09:39:35 +02:00
Max Kellermann
df1152ee0f configure.ac: fix solaris result display
Wrong variable name.
2011-09-19 09:39:05 +02:00
Max Kellermann
b4a8b8c0d4 Makefile.am: rename SPARSE_SOURCES to SPARSE_SRC
Work around automake warning.
2011-09-19 08:03:31 +02:00
Max Kellermann
ffa9f4b47f output/roar: check return values
Fixes gcc warnings.
2011-09-18 12:07:06 +02:00
Max Kellermann
667e22bbc7 output/roar: unknown volume is -1, not 0 2011-09-18 12:06:46 +02:00
Max Kellermann
d4d838c8bb output/roar: move code to roar_cancel_locked() and others
Wrap the locking code.
2011-09-18 11:51:18 +02:00
Max Kellermann
c61a889c86 output/roar: use GLib memory allocation functions
GLib has a built-in OOM handler.
2011-09-17 20:12:45 +02:00
Max Kellermann
567fe89a77 output/roar: use config_get_block_string() for temporary 2011-09-17 20:11:51 +02:00
Max Kellermann
950772ab8a output/roar: reorder methods 2011-09-17 20:10:26 +02:00
Max Kellermann
0bd0e2a3ec output: rename plugin variables
Consistent naming.
2011-09-17 20:04:18 +02:00
Max Kellermann
47774ce882 Merge branch 'v0.16.x' 2011-09-17 19:59:52 +02:00
Max Kellermann
3c9bcdd347 output: per-plugin header
Move the "extern" declarations from output_list.c, for more type
safety.
2011-09-17 19:51:41 +02:00
Max Kellermann
3934d2d30c output/pulse: don't expose internal struct in public header
Provide _lock() and _unlock() to wrap all accesses from the mixer
plugin.
2011-09-17 19:50:36 +02:00
Max Kellermann
423ce9557a output/raop: don't expose internal structs in public header 2011-09-17 19:44:30 +02:00
Max Kellermann
947848ebf6 output/roar: export volume methods
Use these instead of exposing the internal roar_t struct.
2011-09-17 19:33:51 +02:00
Max Kellermann
5e22fe488e output: rename plugin source files 2011-09-17 08:54:50 +02:00
Max Kellermann
c666cf1c44 output/pulse: move code to _setup_stream() 2011-09-17 08:53:53 +02:00
Tim Harder
79435dbdec decoder/audiofile: include stdio header for SEEK_* defines
The stdio header is no longer pulled in by af_vfs.h in audiofile-0.3.0.
2011-09-17 07:33:42 +02:00
Max Kellermann
27206368da output/pulse: improve locking
Always lock the main loop when operating on PULSE objects.  Document
this.
2011-09-17 07:30:59 +02:00
Max Kellermann
2be245b75e input/soup: wait some more before resuming the stream 2011-09-16 21:50:05 +02:00
Max Kellermann
17927f5c26 input/soup: improve error messages
Copy the reason_phrase from the SoupMessage, and check for transport
errors in the session callback.
2011-09-16 21:50:05 +02:00
Max Kellermann
754f26a97c input_stream: non-blocking I/O
Add GMutex, GCond attributes which will be used by callers to
conditionally wait on the stream.

Remove the (now-useless) plugin method buffer(), wait on GCond
instead.  Lock the input_stream before each method call.  Do the same
with the playlist plugins.
2011-09-16 21:22:13 +02:00
Max Kellermann
29241c4f83 input_plugin: add method check()
To check for errors without reading.  The decoder thread wants to do
that, before it passes the input stream to the plugin.
2011-09-16 21:22:02 +02:00
Max Kellermann
6f655eb9b9 input/{soup,curl}: free unused postponed_error
Fix memory leak.
2011-09-16 21:13:25 +02:00
Max Kellermann
65dfd90141 input/soup: move libsoup calls to the I/O thread
libsoup's asynchronous API is not thread safe.  By moving the calls
into the I/O thread, several crash bugs will be fixed.
2011-09-16 20:34:47 +02:00
Max Kellermann
59abdbd2dd input/soup: wait for _cancel_message() to complete
Add the "complete" attribute, and set it in _session_callback().
_close() waits for it to become true.
2011-09-16 20:34:47 +02:00
Max Kellermann
a6d6873856 input/soup: return real GErrors to the caller
Add attribute postponed_error, pass this GError to the caller.
2011-09-16 11:36:09 +02:00
Max Kellermann
e99df3a3be input/soup: set the "ready" flag on failure
Fix deadlock.
2011-09-16 11:35:02 +02:00
Max Kellermann
8b657255cc input/soup: remove redundant flag "ready"
We'll add proper locking now, and there's no need to carry this
duplicate flag.
2011-09-16 11:34:50 +02:00
Max Kellermann
0e1dc79321 input/soup: report failure in _read()
To report failures to callers who don't use _buffer().
2011-09-16 11:30:56 +02:00
Max Kellermann
0ef15e5fac input/soup: unlock before cancelling the soup message
Avoid recursive deadlock in _session_callback().
2011-09-16 11:30:30 +02:00
Max Kellermann
9ea8a840a9 decoder_api: remove the loop from decoder_read()
This was useless, because input_stream_read() blocks until data is
available.  Calling it in a loop doesn't make sense.
2011-09-16 09:15:10 +02:00
Max Kellermann
7b88089593 decoder_api: move code to decoder_check_cancel_read() 2011-09-16 09:15:10 +02:00