Commit Graph

808 Commits

Author SHA1 Message Date
Max Kellermann e5ee357903 lib/upnp/Discovery: use DeferredMonitor instead of BlockingCall() 2017-08-25 11:01:30 +02:00
Max Kellermann 8aef518c05 lib/upnp/Discovery: add method GetEventLoop() 2017-08-25 10:59:49 +02:00
Max Kellermann 309ed77ef4 lib/upnp/Device: use std::string::find() instead of ...find_first_of() 2017-08-25 10:57:40 +02:00
Max Kellermann 9a6d2b791f lib/upnp/Discovery: avoid a std::string copy 2017-08-25 10:55:30 +02:00
Max Kellermann 2a5010a426 lib/upnp/Discovery: remove obsolete comment 2017-08-25 10:16:19 +02:00
Max Kellermann be29da46f8 lib/upnp/Discovery: use std::list::remove_if() 2017-08-25 10:14:18 +02:00
Max Kellermann d0734e27ba lib/upnp/Discovery: use range-based "for" 2017-08-25 10:11:35 +02:00
Max Kellermann c8f7a859ea lib/upnp/Discovery: use CURL instead of UpnpDownloadUrlItem()
We can do CURL requests asynchronously, and we don't need a
synchronous WorkQueue thread for that.

This allows parallelizing lookups and allows immediate cancellation.
2017-08-25 09:52:44 +02:00
Max Kellermann 95637fd153 lib/upnp/Discovery: use strncmp() instead of memcmp()
memcmp() can overflow the buffer.
2017-08-18 18:48:22 +02:00
Max Kellermann b7d0890bc0 lib/curl/Init: share a CurlGlobal instance between input and storage 2017-08-18 13:34:55 +02:00
Max Kellermann 492b20a89d event/SocketMonitor: use class SocketDescriptor 2017-08-10 19:19:58 +02:00
Max Kellermann 4e113a7086 lib/nfs/Connection: use class SocketDescriptor 2017-08-10 17:37:19 +02:00
Max Kellermann 501a4af914 util/StringUtil: move strip functions to StringStrip.cxx 2017-07-05 17:20:02 +02:00
Max Kellermann 979f1b6c39 Merge tag 'v0.20.9'
release v0.20.9
2017-06-04 12:57:05 +02:00
Max Kellermann a057b4f6d8 *: add lost of "noexcept" specifications 2017-06-04 12:46:48 +02:00
Max Kellermann c5996c0593 *: add "noexcept" to many, many function prototypes
See commit 71f0ed8b74
2017-05-15 23:05:45 +02:00
Max Kellermann 4faef28cc5 Merge tag 'v0.20.7'
release v0.20.7
2017-05-15 23:01:49 +02:00
Max Kellermann 788e3b31e1 *: remove "pure" and "const" attributes from throwing functions
The "pure" and "const" attributes are not so well-defined, and a
recent clang version implements an optimization which pushes the
definition's boundary beyond what I believed it was.  clang now
assumes that functions declared "pure" cannot throw exceptions, even
if they lack the "noexcept" specification.

When compiled with this new clang version, MPD will crash randomly if
an exception happens to get thrown by such as "pure" function
(https://github.com/MusicPlayerDaemon/MPD/issues/41).

This commit removes all such misplaced "pure" and "const" attributes,
closing #41.
2017-05-08 17:25:06 +02:00
Max Kellermann 71f0ed8b74 *: add "noexcept" to many, many function prototypes
This eliminates some overhead, because the compiler doesn't need to
consider these functions throwing.
2017-05-08 14:44:49 +02:00
Max Kellermann b4e4bdcda9 lib/alsa/Version: wrapper for snd_asoundlib_version() 2017-03-29 20:33:06 +02:00
Max Kellermann e26d49efb7 Merge tag 'v0.20.6'
release v0.20.6
2017-03-10 17:02:32 +01:00
Max Kellermann ac8dce6599 lib/curl/Request: "ICY 200 OK" is a response boundary header 2017-03-10 16:28:02 +01:00
Max Kellermann 190d525099 lib/curl/Request: move code to IsResponseBoundaryHeader() 2017-03-10 16:24:30 +01:00
Max Kellermann 9e503b21c1 {input,mixer}/alsa: move code to lib/alsa/NonBlock.cxx 2017-02-09 21:24:24 +01:00
Max Kellermann 03a97d87ea tag/Tag*: rename several source files 2017-02-08 08:49:42 +01:00
Max Kellermann 53c14d97a6 lib/nfs/FileReader: remove debug line 2017-02-08 08:43:56 +01:00
Max Kellermann 45cadef22f configure.ac: prepare for 0.20.5 2017-02-06 23:28:36 +01:00
Max Kellermann df4af2b550 Merge tag 'v0.20.4'
release v0.20.4
2017-02-01 22:05:33 +01:00
Max Kellermann 591afa0647 lib/nfs/Connection: detect socket hangup and unregister from epoll
Fixes race condition when epoll_ctl() gets called after the socket has
been closed, which may affect a different socket created by another
thread meanwhile.
2017-02-01 21:44:20 +01:00
Max Kellermann 05eac20ffe lib/nfs/Connection: detect libnfs reconnect
When rpc_reconnect_requeue() gets called from inside nfs_service(),
the NfsInputStream can stall completely because the old socket has
been unregistered from epoll automatically, but the new one has never
been registered.  Therefore, nfs_service() will never be called again.

This kludge attempts to detect this condition by checking
nfs_which_events()==POLLOUT.

https://bugs.musicpd.org/view.php?id=4081
2017-02-01 21:36:58 +01:00
Max Kellermann add953fb6e lib/curl/Global: decouple from the IOThread library 2017-01-26 09:29:49 +01:00
Max Kellermann 6d5904801e lib/nfs/FileReader: use nfs_get_event_loop()
Make sure we're using the same EventLoop as the NfsManager.
2017-01-26 09:23:49 +01:00
Max Kellermann d4993c405e lib/nfs/Glue: add EventLoop& accessor 2017-01-26 09:23:25 +01:00
Max Kellermann 611ce6e756 lib/nfs/{FileReader,Glue}: pass EventLoop&
Eliminate dependency on io_thread_get().
2017-01-25 23:02:02 +01:00
Max Kellermann 44dd9af276 lib/upnp/Util: pass single delimiter character to stringToTokens() 2017-01-23 19:34:55 +01:00
Max Kellermann d3013d4f8c lib/upnp/Util: remove parameter "skipinit", always true 2017-01-23 19:28:07 +01:00
Max Kellermann 678524ad21 lib/upnp/WorkQueue: fix race condition
With "ok==false", newly created threads may quit instantly.
2017-01-23 19:25:30 +01:00
Max Kellermann 32a64481f2 lib/upnp: fix bad std::chrono cast
libupnp provides seconds, not whatever time unit is used by
std::chrono::steady_clock.
2017-01-23 19:16:14 +01:00
Max Kellermann ec8cba369c lib/upnp/WorkQueue: disallow copying 2017-01-23 18:35:58 +01:00
Max Kellermann f4c248f406 lib/upnp/WorkQueue: make constructor explicit 2017-01-23 18:35:47 +01:00
Max Kellermann f3b2a58646 lib/upnp/WorkQueue: use C++11 initializers 2017-01-23 18:35:22 +01:00
Max Kellermann 6eea56861b AUTHORS, ...: update my email address 2017-01-17 11:54:55 +01:00
Max Kellermann 6c293a3d7f lib/nfs: add more API documentation 2017-01-15 00:58:49 +01:00
Max Kellermann 58fb36bdb9 storage/http: new storage plugin 2017-01-08 14:40:20 +01:00
Max Kellermann 4297a7b0a4 lib/curl/Request: move exception handling out of the WRITEFUNCTION
libcurl's WRITEFUNCTION is pretty fragile; if we destroy the CURL*
instance or even unregister it using curl_multi_remove_handle(),
libcurl will crash instantly.  But still we need to be able to handle
exceptions from inside the WRITEFUNCTION, and call
CurlResponseHandler::OnError(), which may destroy the whole thing.  As
a workaround, I use DeferredMonitor to postpone the OnError() call
into a stack frame which is allowed to destroy the request.
2017-01-08 14:36:27 +01:00
Max Kellermann 1bab6d0dd7 lib/curl/Request: move catch clause out of FinishHeaders
Let the caller decide what to do with the exception.
2017-01-08 14:36:27 +01:00
Max Kellermann 13b85edbe2 lib/curl/Request: postpone the curl_easy_cleanup() call
When the request is done, only unregister the CURL* handle, but do not
delete it yet - it may still be needed for CURLINFO_RESPONSE_CODE.
2017-01-08 13:51:53 +01:00
Max Kellermann dc53098e43 lib/curl/Request: allow Stop() to be called twice
Convert assertion to runtime check.  This is useful because this is a
public method, and the caller has no chance to check if the object is
still registered.
2017-01-08 13:51:53 +01:00
Max Kellermann 3c66feff5a lib/curl/Global: defer the ReadInfo() call
Fixes a crash that can occur due to recursion from InvalidateSockets()
to ReadInfo() to CurlRequest callbacks.
2017-01-08 12:46:35 +01:00
Max Kellermann 218c3bc0d5 lib/curl/Multi: fix typo 2017-01-08 12:46:35 +01:00