From 3c5931bb13b5f88edcebb375fa6964dde8b85563 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Thu, 26 Jul 2012 15:27:03 +0000 Subject: Report subject with errors to client for more meaningful error messages. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@4556 a436a847-0d15-0410-975c-d299462d15a1 --- src/server/events/Get.cpp | 29 ++++++++++------------------- 1 file changed, 10 insertions(+), 19 deletions(-) (limited to 'src/server/events/Get.cpp') diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp index 24f3d1d9..cc64aaef 100644 --- a/src/server/events/Get.cpp +++ b/src/server/events/Get.cpp @@ -56,12 +56,14 @@ Get::pre_process() if (_uri == "ingen:plugins") { _plugins = _engine.node_factory()->plugins(); return Event::pre_process_done(SUCCESS); + } else if (_uri == "ingen:engine") { + return Event::pre_process_done(SUCCESS); } else if (Raul::Path::is_valid(_uri.str())) { _object = _engine.engine_store()->find_object(Raul::Path(_uri.str())); - return Event::pre_process_done(_object ? SUCCESS : NOT_FOUND); + return Event::pre_process_done(_object ? SUCCESS : NOT_FOUND, _uri); } else { _plugin = _engine.node_factory()->plugin(_uri); - return Event::pre_process_done(_plugin ? SUCCESS : NOT_FOUND); + return Event::pre_process_done(_plugin ? SUCCESS : NOT_FOUND, _uri); } } @@ -127,28 +129,17 @@ send_patch(Interface* client, const PatchImpl* patch) void Get::post_process() { - if (_uri == "ingen:plugins") { - respond(SUCCESS); - if (_request_client) { + if (!respond() && _request_client) { + if (_uri == "ingen:plugins") { _engine.broadcaster()->send_plugins_to(_request_client.get(), _plugins); - } - } else if (_uri == "ingen:engine") { - respond(SUCCESS); - // TODO: Keep a proper RDF model of the engine - if (_request_client) { + } else if (_uri == "ingen:engine") { + // TODO: Keep a proper RDF model of the engine Shared::URIs& uris = _engine.world()->uris(); _request_client->set_property( uris.ingen_engine, uris.ingen_sampleRate, uris.forge.make(int32_t(_engine.driver()->sample_rate()))); - } - } else if (!_object && !_plugin) { - respond(NOT_FOUND); - } else if (!_request_client) { - respond(CLIENT_NOT_FOUND); - } else { - respond(SUCCESS); - if (_object) { + } else if (_object) { _request_client->bundle_begin(); const NodeImpl* node = NULL; const PatchImpl* patch = NULL; @@ -164,8 +155,8 @@ Get::post_process() } else if (_plugin) { _request_client->put(_uri, _plugin->properties()); } - _lock.release(); } + _lock.release(); } } // namespace Events -- cgit v1.2.1