diff options
author | Max Kellermann <max@musicpd.org> | 2018-06-04 21:48:39 +0200 |
---|---|---|
committer | Max Kellermann <max@musicpd.org> | 2018-06-04 21:50:34 +0200 |
commit | 7eee79c14570cea5ae2a890bb443cbbf6c05d657 (patch) | |
tree | 773e33f960c8c65680126b79f9db916ebb100b49 /src/neighbor | |
parent | 9626523420e390dc826e56946ec6307ba3c4e2f1 (diff) |
neighbor/udisks: move code to class UDisks2::ParseObjects(ODBus::Message)
Diffstat (limited to 'src/neighbor')
-rw-r--r-- | src/neighbor/plugins/UdisksNeighborPlugin.cxx | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/src/neighbor/plugins/UdisksNeighborPlugin.cxx b/src/neighbor/plugins/UdisksNeighborPlugin.cxx index dc809062d..a161346ec 100644 --- a/src/neighbor/plugins/UdisksNeighborPlugin.cxx +++ b/src/neighbor/plugins/UdisksNeighborPlugin.cxx @@ -34,7 +34,6 @@ #include "event/Call.hxx" #include "thread/Mutex.hxx" #include "thread/SafeSingleton.hxx" -#include "util/Domain.hxx" #include "util/Manual.hxx" #include "Log.hxx" @@ -43,8 +42,6 @@ #include <list> #include <map> -static constexpr Domain udisks_domain("udisks"); - static NeighborInfo ToNeighborInfo(const UDisks2::Object &o) noexcept { @@ -216,24 +213,15 @@ UdisksNeighborExplorer::Remove(const std::string &path) noexcept inline void UdisksNeighborExplorer::OnListNotify(ODBus::Message reply) noexcept { - using namespace ODBus; - - try { - reply.CheckThrowError(); + try{ + ParseObjects(reply, + std::bind(&UdisksNeighborExplorer::Insert, + this, std::placeholders::_1)); } catch (...) { - LogError(std::current_exception()); + LogError(std::current_exception(), + "Failed to parse GetManagedObjects reply"); return; } - - ReadMessageIter i(*reply.Get()); - if (i.GetArgType() != DBUS_TYPE_ARRAY) { - LogError(udisks_domain, "Malformed response"); - return; - } - - ParseObjects(i.Recurse(), - std::bind(&UdisksNeighborExplorer::Insert, - this, std::placeholders::_1)); } inline DBusHandlerResult |