diff options
29 files changed, 116 insertions, 112 deletions
diff --git a/ingen/Interface.hpp b/ingen/Interface.hpp index 94faeab9..0ad9e1ba 100644 --- a/ingen/Interface.hpp +++ b/ingen/Interface.hpp @@ -94,7 +94,9 @@ public: virtual void get(const Raul::URI& uri) = 0; // Response - virtual void response(int32_t id, Status status) = 0; + virtual void response(int32_t id, + Status status, + const std::string& subject) = 0; // Non-response error virtual void error(const std::string& msg) = 0; diff --git a/ingen/client/ClientStore.hpp b/ingen/client/ClientStore.hpp index 1512b941..b5a51a83 100644 --- a/ingen/client/ClientStore.hpp +++ b/ingen/client/ClientStore.hpp @@ -102,7 +102,7 @@ public: void set_response_id(int32_t id) {} void get(const Raul::URI& uri) {} - void response(int32_t id, Status status) {} + void response(int32_t id, Status status, const std::string& subject) {} void error(const std::string& msg) {} INGEN_SIGNAL(new_object, void, SharedPtr<ObjectModel>); diff --git a/ingen/client/SigClientInterface.hpp b/ingen/client/SigClientInterface.hpp index 8b43bca0..4aef5a40 100644 --- a/ingen/client/SigClientInterface.hpp +++ b/ingen/client/SigClientInterface.hpp @@ -47,7 +47,7 @@ public: Raul::URI uri() const { return "http://drobilla.net/ns/ingen#internal"; } - INGEN_SIGNAL(response, void, int32_t, Status) + INGEN_SIGNAL(response, void, int32_t, Status, std::string) INGEN_SIGNAL(bundle_begin, void) INGEN_SIGNAL(bundle_end, void) INGEN_SIGNAL(error, void, std::string) @@ -75,8 +75,8 @@ protected: void bundle_end() { EMIT(bundle_end); } - void response(int32_t id, Status status) - { EMIT(response, id, status); } + void response(int32_t id, Status status, const std::string& subject) + { EMIT(response, id, status, subject); } void error(const std::string& msg) { EMIT(error, msg); } diff --git a/ingen/client/ThreadedSigClientInterface.hpp b/ingen/client/ThreadedSigClientInterface.hpp index 71e1b2ee..c321f438 100644 --- a/ingen/client/ThreadedSigClientInterface.hpp +++ b/ingen/client/ThreadedSigClientInterface.hpp @@ -73,8 +73,8 @@ public: void bundle_end() { push_sig(bundle_end_slot); } - void response(int32_t id, Status status) - { push_sig(sigc::bind(response_slot, id, status)); } + void response(int32_t id, Status status, const std::string& subject) + { push_sig(sigc::bind(response_slot, id, status, subject)); } void error(const std::string& msg) { push_sig(sigc::bind(error_slot, msg)); } @@ -149,7 +149,7 @@ private: sigc::slot<void> bundle_begin_slot; sigc::slot<void> bundle_end_slot; - sigc::slot<void, int32_t, Status> response_slot; + sigc::slot<void, int32_t, Status, std::string> response_slot; sigc::slot<void, std::string> error_slot; sigc::slot<void, Raul::URI, Raul::URI, Raul::Symbol> new_plugin_slot; sigc::slot<void, Raul::URI, Resource::Properties, diff --git a/ingen/shared/AtomWriter.hpp b/ingen/shared/AtomWriter.hpp index 585c362a..7087bfd6 100644 --- a/ingen/shared/AtomWriter.hpp +++ b/ingen/shared/AtomWriter.hpp @@ -73,7 +73,7 @@ public: void get(const Raul::URI& uri); - void response(int32_t id, Status status); + void response(int32_t id, Status status, const std::string& subject); void error(const std::string& msg); diff --git a/ingen/shared/ClashAvoider.hpp b/ingen/shared/ClashAvoider.hpp index 40b1bdb6..e3f4faaf 100644 --- a/ingen/shared/ClashAvoider.hpp +++ b/ingen/shared/ClashAvoider.hpp @@ -83,7 +83,7 @@ public: virtual void set_response_id(int32_t id) {} virtual void get(const Raul::URI& uri) {} - virtual void response(int32_t id, Status status) {} + virtual void response(int32_t id, Status status, const std::string& subject) {} virtual void error(const std::string& msg) {} private: diff --git a/ingen/shared/URIs.hpp b/ingen/shared/URIs.hpp index 7e27bb34..9e604841 100644 --- a/ingen/shared/URIs.hpp +++ b/ingen/shared/URIs.hpp @@ -91,6 +91,7 @@ public: const Quark ingen_polyphony; const Quark ingen_prototype; const Quark ingen_sampleRate; + const Quark ingen_status; const Quark ingen_tail; const Quark ingen_uiEmbedded; const Quark ingen_value; diff --git a/src/bindings/Client.hpp b/src/bindings/Client.hpp index f8dd84ff..248c71ec 100644 --- a/src/bindings/Client.hpp +++ b/src/bindings/Client.hpp @@ -31,7 +31,7 @@ public: void bundle_begin() {} void bundle_end() {} - void response(int32_t id, Status status) {} + void response(int32_t id, Status status, const std::string& subject) {} void error(const std::string& msg) {} void put(const Raul::URI& path, const Ingen::Resource::Properties& properties) {} void connect(const Raul::Path& src_port_path, const Raul::Path& dst_port_path) {} diff --git a/src/gui/App.cpp b/src/gui/App.cpp index a815c6e7..1d6381fb 100644 --- a/src/gui/App.cpp +++ b/src/gui/App.cpp @@ -203,10 +203,14 @@ App::serialiser() } void -App::response(int32_t id, Status status) +App::response(int32_t id, Status status, const std::string& subject) { if (status) { - error_message(ingen_status_string(status)); + std::string msg = ingen_status_string(status); + if (!subject.empty()) { + msg += ": " + subject; + } + error_message(msg); } } diff --git a/src/gui/App.hpp b/src/gui/App.hpp index 7969982c..1f611a13 100644 --- a/src/gui/App.hpp +++ b/src/gui/App.hpp @@ -140,7 +140,7 @@ protected: explicit App(Ingen::Shared::World* world); bool animate(); - void response(int32_t id, Ingen::Status status); + void response(int32_t id, Ingen::Status status, const std::string& subject); void property_change(const Raul::URI& subject, const Raul::URI& key, diff --git a/src/gui/ConnectWindow.hpp b/src/gui/ConnectWindow.hpp index 00ba5fd3..ca27787e 100644 --- a/src/gui/ConnectWindow.hpp +++ b/src/gui/ConnectWindow.hpp @@ -51,7 +51,9 @@ public: void set_connected_to(SharedPtr<Ingen::Interface> engine); void start(App& app, Ingen::Shared::World* world); - void ingen_response(int32_t id, Status status) { _attached = true; } + void ingen_response(int32_t id, Status status, const std::string& subject) { + _attached = true; + } bool attached() const { return _finished_connecting; } bool quit_flag() const { return _quit_flag; } diff --git a/src/server/Broadcaster.hpp b/src/server/Broadcaster.hpp index 2c88c5f8..32a1ab92 100644 --- a/src/server/Broadcaster.hpp +++ b/src/server/Broadcaster.hpp @@ -106,7 +106,7 @@ public: void set_response_id(int32_t id) {} ///< N/A void get(const Raul::URI& uri) {} ///< N/A - void response(int32_t id, Status status) {} ///< N/A + void response(int32_t id, Status status, const std::string& subject) {} ///< N/A void error(const std::string& msg) { BROADCAST(error, msg); } diff --git a/src/server/Event.hpp b/src/server/Event.hpp index 963671ab..5f2e99bb 100644 --- a/src/server/Event.hpp +++ b/src/server/Event.hpp @@ -78,13 +78,6 @@ public: /** Return the status (success or error code) of this event. */ Status status() const { return _status; } - /** Respond to the originating client. */ - void respond(Status status) { - if (_request_client) { - _request_client->response(_request_id, status); - } - } - protected: Event(Engine& engine, SharedPtr<Interface> client, int32_t id, FrameTime time) : _engine(engine) @@ -107,12 +100,27 @@ protected: return !st; } + inline bool pre_process_done(Status st, const Raul::URI& subject) { + _status = st; + _err_subject = subject.str(); + return !st; + } + + /** Respond to the originating client. */ + inline Status respond() { + if (_request_client) { + _request_client->response(_request_id, _status, _err_subject); + } + return _status; + } + Engine& _engine; Raul::AtomicPtr<Event> _next; SharedPtr<Interface> _request_client; int32_t _request_id; FrameTime _time; Status _status; + std::string _err_subject; }; } // namespace Server diff --git a/src/server/EventWriter.hpp b/src/server/EventWriter.hpp index 2a080be4..d25dc113 100644 --- a/src/server/EventWriter.hpp +++ b/src/server/EventWriter.hpp @@ -84,7 +84,7 @@ public: virtual void get(const Raul::URI& uri); - virtual void response(int32_t id, Status status) {} ///< N/A + virtual void response(int32_t id, Status status, const std::string& subject) {} ///< N/A virtual void error(const std::string& msg) {} ///< N/A diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp index b9ea148a..dc6f7b99 100644 --- a/src/server/events/Connect.cpp +++ b/src/server/events/Connect.cpp @@ -57,30 +57,32 @@ Connect::pre_process() PortImpl* tail = _engine.engine_store()->find_port(_tail_path); PortImpl* head = _engine.engine_store()->find_port(_head_path); - if (!tail || !head) { - return Event::pre_process_done(PORT_NOT_FOUND); + if (!tail) { + return Event::pre_process_done(PORT_NOT_FOUND, _tail_path.str()); + } else if (!head) { + return Event::pre_process_done(PORT_NOT_FOUND, _head_path.str()); } _dst_input_port = dynamic_cast<InputPort*>(head); _src_output_port = dynamic_cast<OutputPort*>(tail); if (!_dst_input_port || !_src_output_port) { - return Event::pre_process_done(DIRECTION_MISMATCH); + return Event::pre_process_done(DIRECTION_MISMATCH, _head_path.str()); } NodeImpl* const src_node = tail->parent_node(); NodeImpl* const dst_node = head->parent_node(); if (!src_node || !dst_node) { - return Event::pre_process_done(PARENT_NOT_FOUND); + return Event::pre_process_done(PARENT_NOT_FOUND, _head_path.str()); } if (src_node->parent() != dst_node->parent() && src_node != dst_node->parent() && src_node->parent() != dst_node) { - return Event::pre_process_done(PARENT_DIFFERS); + return Event::pre_process_done(PARENT_DIFFERS, _head_path.str()); } if (!EdgeImpl::can_connect(_src_output_port, _dst_input_port)) { - return Event::pre_process_done(TYPE_MISMATCH); + return Event::pre_process_done(TYPE_MISMATCH, _head_path); } if (src_node->parent_patch() != dst_node->parent_patch()) { @@ -100,7 +102,7 @@ Connect::pre_process() } if (_patch->has_edge(_src_output_port, _dst_input_port)) { - return Event::pre_process_done(EXISTS); + return Event::pre_process_done(EXISTS, _head_path); } _edge = SharedPtr<EdgeImpl>( @@ -151,8 +153,7 @@ Connect::execute(ProcessContext& context) void Connect::post_process() { - respond(_status); - if (!_status) { + if (!respond()) { _engine.broadcaster()->connect(_tail_path, _head_path); } } diff --git a/src/server/events/CreateNode.cpp b/src/server/events/CreateNode.cpp index 76f29613..b8e795e8 100644 --- a/src/server/events/CreateNode.cpp +++ b/src/server/events/CreateNode.cpp @@ -61,16 +61,16 @@ CreateNode::pre_process() } if (_engine.engine_store()->find_object(_path)) { - return Event::pre_process_done(EXISTS); + return Event::pre_process_done(EXISTS, _path.str()); } if (!(_patch = _engine.engine_store()->find_patch(_path.parent()))) { - return Event::pre_process_done(PARENT_NOT_FOUND); + return Event::pre_process_done(PARENT_NOT_FOUND, _path.parent().str()); } PluginImpl* plugin = _engine.node_factory()->plugin(_plugin_uri); if (!plugin) { - return Event::pre_process_done(PLUGIN_NOT_FOUND); + return Event::pre_process_done(PLUGIN_NOT_FOUND, _plugin_uri); } const iterator p = _properties.find(uris.ingen_polyphonic); @@ -84,7 +84,7 @@ CreateNode::pre_process() polyphonic, _patch, _engine))) { - return Event::pre_process_done(CREATION_FAILED); + return Event::pre_process_done(CREATION_FAILED, _path.str()); } _node->properties().insert(_properties.begin(), _properties.end()); @@ -125,8 +125,7 @@ CreateNode::execute(ProcessContext& context) void CreateNode::post_process() { - respond(_status); - if (!_status) { + if (!respond()) { for (Update::const_iterator i = _update.begin(); i != _update.end(); ++i) { _engine.broadcaster()->put(i->first, i->second); } diff --git a/src/server/events/CreatePatch.cpp b/src/server/events/CreatePatch.cpp index b6b62f71..602fe2a4 100644 --- a/src/server/events/CreatePatch.cpp +++ b/src/server/events/CreatePatch.cpp @@ -48,14 +48,14 @@ bool CreatePatch::pre_process() { if (_path.is_root() || _engine.engine_store()->find_object(_path) != NULL) { - return Event::pre_process_done(EXISTS); + return Event::pre_process_done(EXISTS, _path); } const Raul::Path& path = (const Raul::Path&)_path; _parent = _engine.engine_store()->find_patch(path.parent()); if (!_parent) { - return Event::pre_process_done(PARENT_NOT_FOUND); + return Event::pre_process_done(PARENT_NOT_FOUND, path.parent()); } const Ingen::Shared::URIs& uris = _engine.world()->uris(); @@ -70,7 +70,7 @@ CreatePatch::pre_process() } if (int_poly < 1) { - return Event::pre_process_done(INVALID_POLY); + return Event::pre_process_done(INVALID_POLY, path); } if (int_poly == _parent->internal_poly()) { @@ -114,8 +114,7 @@ CreatePatch::execute(ProcessContext& context) void CreatePatch::post_process() { - respond(_status); - if (!_status) { + if (!respond()) { _engine.broadcaster()->put(_path, _update); } } diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp index 9ddb8894..b89a90cc 100644 --- a/src/server/events/CreatePort.cpp +++ b/src/server/events/CreatePort.cpp @@ -85,15 +85,15 @@ bool CreatePort::pre_process() { if (_port_type == PortType::UNKNOWN) { - return Event::pre_process_done(UNKNOWN_TYPE); + return Event::pre_process_done(UNKNOWN_TYPE, _path); } if (_engine.engine_store()->find_object(_path)) { - return Event::pre_process_done(_status); + return Event::pre_process_done(_status, _path); } if (!(_patch = _engine.engine_store()->find_patch(_path.parent()))) { - return Event::pre_process_done(PARENT_NOT_FOUND); + return Event::pre_process_done(PARENT_NOT_FOUND, _path.parent()); } const Shared::URIs& uris = _engine.world()->uris(); @@ -112,7 +112,7 @@ CreatePort::pre_process() _engine.world()->forge().make(old_n_ports))); } else if (index_i->second.type() != uris.forge.Int || index_i->second.get_int32() != old_n_ports) { - return Event::pre_process_done(BAD_INDEX); + return Event::pre_process_done(BAD_INDEX, _path); } const PropIter poly_i = _properties.find(uris.ingen_polyphonic); @@ -123,7 +123,7 @@ CreatePort::pre_process() if (!(_patch_port = _patch->create_port( *_engine.buffer_factory(), _path.symbol(), _port_type, _buf_type, buf_size, _is_output, polyphonic))) { - return Event::pre_process_done(CREATION_FAILED); + return Event::pre_process_done(CREATION_FAILED, _path); } _patch_port->properties().insert(_properties.begin(), _properties.end()); @@ -174,8 +174,7 @@ CreatePort::execute(ProcessContext& context) void CreatePort::post_process() { - respond(_status); - if (!_status) { + if (!respond()) { _engine.broadcaster()->put(_path, _update); } diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp index 7ef4d2a5..9c68f4fe 100644 --- a/src/server/events/Delete.cpp +++ b/src/server/events/Delete.cpp @@ -63,8 +63,10 @@ Delete::~Delete() bool Delete::pre_process() { - if (_path.is_root() || _path == "path:/control_in" || _path == "path:/control_out") { - return Event::pre_process_done(NOT_DELETABLE); + if (_path.is_root() || + _path == "path:/control_in" || + _path == "path:/control_out") { + return Event::pre_process_done(NOT_DELETABLE, _path); } _lock.acquire(); @@ -157,13 +159,7 @@ Delete::post_process() { _lock.release(); _removed_bindings.reset(); - - if (!Raul::Path::is_path(_uri) - || _path.is_root() || _path == "path:/control_in" || _path == "path:/control_out") { - // XXX: Report error? Silently ignore? - } else if (!_node && !_port) { - respond(NOT_FOUND); - } else if (_patch_node_listnode || _patch_port_listnode) { + if (!respond() && (_patch_node_listnode || _patch_port_listnode)) { if (_patch_node_listnode) { _node->deactivate(); delete _patch_node_listnode; @@ -171,15 +167,12 @@ Delete::post_process() delete _patch_port_listnode; } - respond(SUCCESS); _engine.broadcaster()->bundle_begin(); if (_disconnect_event) { _disconnect_event->post_process(); } _engine.broadcaster()->del(_path); _engine.broadcaster()->bundle_end(); - } else { - respond(FAILURE); } if (_engine_port) { diff --git a/src/server/events/Delta.cpp b/src/server/events/Delta.cpp index 8da4b230..0f067a7e 100644 --- a/src/server/events/Delta.cpp +++ b/src/server/events/Delta.cpp @@ -113,7 +113,7 @@ Delta::pre_process() : static_cast<Shared::ResourceImpl*>(_engine.node_factory()->plugin(_subject)); if (!_object && (!is_graph_object || !_create)) { - return Event::pre_process_done(NOT_FOUND); + return Event::pre_process_done(NOT_FOUND, _subject); } const Ingen::Shared::URIs& uris = _engine.world()->uris(); @@ -139,7 +139,7 @@ Delta::pre_process() // Grab the object for applying properties, if the create-event succeeded _object = _engine.engine_store()->find_object(Raul::Path(_subject.str())); } else { - return Event::pre_process_done(BAD_OBJECT_TYPE); + return Event::pre_process_done(BAD_OBJECT_TYPE, _subject); } } @@ -250,7 +250,8 @@ Delta::pre_process() _types.push_back(op); } - return Event::pre_process_done(_status == NOT_PREPARED ? SUCCESS : _status); + return Event::pre_process_done(_status == NOT_PREPARED ? SUCCESS : _status, + _subject); } void @@ -346,7 +347,7 @@ Delta::post_process() if (_create_event) { _create_event->post_process(); } else { - respond(SUCCESS); + respond(); if (_create) { _engine.broadcaster()->put(_subject, _properties, _context); } else { @@ -354,7 +355,7 @@ Delta::post_process() } } } else { - respond(_status); + respond(); } } diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp index 3ad9f650..00e4b374 100644 --- a/src/server/events/Disconnect.cpp +++ b/src/server/events/Disconnect.cpp @@ -119,14 +119,16 @@ Disconnect::pre_process() if (_tail_path.parent().parent() != _head_path.parent().parent() && _tail_path.parent() != _head_path.parent().parent() && _tail_path.parent().parent() != _head_path.parent()) { - return Event::pre_process_done(PARENT_DIFFERS); + return Event::pre_process_done(PARENT_DIFFERS, _head_path); } _tail = _engine.engine_store()->find_port(_tail_path); _head = _engine.engine_store()->find_port(_head_path); - if (_tail == NULL || _head == NULL) { - return Event::pre_process_done(PORT_NOT_FOUND); + if (!_tail) { + return Event::pre_process_done(PORT_NOT_FOUND, _tail_path); + } else if (!_head) { + return Event::pre_process_done(PORT_NOT_FOUND, _head_path); } NodeImpl* const src_node = _tail->parent_node(); @@ -151,11 +153,11 @@ Disconnect::pre_process() assert(_patch); if (!_patch->has_edge(_tail, _head)) { - return Event::pre_process_done(NOT_FOUND); + return Event::pre_process_done(NOT_FOUND, _head_path); } if (src_node == NULL || dst_node == NULL) { - return Event::pre_process_done(PARENT_NOT_FOUND); + return Event::pre_process_done(PARENT_NOT_FOUND, _head_path); } _impl = new Impl(_engine, @@ -214,8 +216,7 @@ Disconnect::execute(ProcessContext& context) void Disconnect::post_process() { - respond(_status); - if (!_status) { + if (!respond()) { _engine.broadcaster()->disconnect(_tail->path(), _head->path()); } diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp index d360073c..e1310251 100644 --- a/src/server/events/DisconnectAll.cpp +++ b/src/server/events/DisconnectAll.cpp @@ -89,17 +89,17 @@ DisconnectAll::pre_process() _parent = _engine.engine_store()->find_patch(_parent_path); if (!_parent) { - return Event::pre_process_done(PARENT_NOT_FOUND); + return Event::pre_process_done(PARENT_NOT_FOUND, _parent_path); } GraphObjectImpl* object = _engine.engine_store()->find_object(_path); if (!object) { - return Event::pre_process_done(NOT_FOUND); + return Event::pre_process_done(NOT_FOUND, _path); } if (object->parent_patch() != _parent && object->parent()->parent_patch() != _parent) { - return Event::pre_process_done(INVALID_PARENT_PATH); + return Event::pre_process_done(INVALID_PARENT_PATH, _parent_path); } // Only one of these will succeed @@ -159,8 +159,7 @@ DisconnectAll::execute(ProcessContext& context) void DisconnectAll::post_process() { - respond(_status); - if (!_status) { + if (!respond()) { _engine.broadcaster()->disconnect_all(_parent_path, _path); } } 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 diff --git a/src/server/events/Move.cpp b/src/server/events/Move.cpp index 9a894e43..483c77e7 100644 --- a/src/server/events/Move.cpp +++ b/src/server/events/Move.cpp @@ -55,16 +55,16 @@ Move::pre_process() Glib::RWLock::WriterLock lock(_engine.engine_store()->lock()); if (!_old_path.parent().is_parent_of(_new_path)) { - return Event::pre_process_done(PARENT_DIFFERS); + return Event::pre_process_done(PARENT_DIFFERS, _new_path); } _store_iterator = _engine.engine_store()->find(_old_path); if (_store_iterator == _engine.engine_store()->end()) { - return Event::pre_process_done(NOT_FOUND); + return Event::pre_process_done(NOT_FOUND, _old_path); } if (_engine.engine_store()->find_object(_new_path)) { - return Event::pre_process_done(EXISTS); + return Event::pre_process_done(EXISTS, _new_path); } SharedPtr< Raul::Table< Raul::Path, SharedPtr<GraphObject> > > removed @@ -106,8 +106,7 @@ Move::execute(ProcessContext& context) void Move::post_process() { - respond(_status); - if (!_status) { + if (!respond()) { _engine.broadcaster()->move(_old_path, _new_path); } } diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp index 673c9984..005974a2 100644 --- a/src/server/events/SetPortValue.cpp +++ b/src/server/events/SetPortValue.cpp @@ -57,7 +57,7 @@ bool SetPortValue::pre_process() { if (_port->is_output()) { - return Event::pre_process_done(DIRECTION_MISMATCH); + return Event::pre_process_done(DIRECTION_MISMATCH, _port_path); } // Port is on a message context node, set value and run @@ -129,8 +129,7 @@ SetPortValue::apply(Context& context) void SetPortValue::post_process() { - respond(_status); - if (!_status) { + if (!respond()) { _engine.broadcaster()->set_property( _port_path, _engine.world()->uris().ingen_value, diff --git a/src/shared/AtomReader.cpp b/src/shared/AtomReader.cpp index 2bdd9fe1..862c61b1 100644 --- a/src/shared/AtomReader.cpp +++ b/src/shared/AtomReader.cpp @@ -261,7 +261,8 @@ AtomReader::write(const LV2_Atom* msg) return false; } _iface.response(((LV2_Atom_Int*)request)->body, - (Ingen::Status)((LV2_Atom_Int*)body)->body); + (Ingen::Status)((LV2_Atom_Int*)body)->body, + subject_uri); } else { Raul::warn << "Unknown object type <" << _map.unmap_uri(obj->body.otype) diff --git a/src/shared/AtomWriter.cpp b/src/shared/AtomWriter.cpp index 7d600466..80bd0156 100644 --- a/src/shared/AtomWriter.cpp +++ b/src/shared/AtomWriter.cpp @@ -272,7 +272,7 @@ AtomWriter::get(const Raul::URI& uri) } void -AtomWriter::response(int32_t id, Status status) +AtomWriter::response(int32_t id, Status status, const std::string& subject) { if (id == -1) { return; @@ -282,6 +282,10 @@ AtomWriter::response(int32_t id, Status status) lv2_atom_forge_blank(&_forge, &msg, next_id(), _uris.patch_Response); lv2_atom_forge_property_head(&_forge, _uris.patch_request, 0); lv2_atom_forge_int(&_forge, id); + if (!subject.empty() && Raul::URI::is_valid(subject)) { + lv2_atom_forge_property_head(&_forge, _uris.patch_subject, 0); + lv2_atom_forge_uri(&_forge, subject.c_str(), subject.length()); + } lv2_atom_forge_property_head(&_forge, _uris.patch_body, 0); lv2_atom_forge_int(&_forge, status); lv2_atom_forge_pop(&_forge, &msg); diff --git a/src/shared/URIs.cpp b/src/shared/URIs.cpp index b41a0db3..102c7b8b 100644 --- a/src/shared/URIs.cpp +++ b/src/shared/URIs.cpp @@ -75,6 +75,7 @@ URIs::URIs(Shared::Forge& f, URIMap* map) , ingen_polyphony (forge, map, NS_INGEN "polyphony") , ingen_prototype (forge, map, NS_INGEN "prototype") , ingen_sampleRate (forge, map, NS_INGEN "sampleRate") + , ingen_status (forge, map, NS_INGEN "status") , ingen_tail (forge, map, NS_INGEN "tail") , ingen_uiEmbedded (forge, map, NS_INGEN "uiEmbedded") , ingen_value (forge, map, NS_INGEN "value") diff --git a/tests/ingen_test.cpp b/tests/ingen_test.cpp index ec41cb2c..dcde210f 100644 --- a/tests/ingen_test.cpp +++ b/tests/ingen_test.cpp @@ -106,10 +106,10 @@ public: void get(const Raul::URI& uri) {} - void response(int32_t id, Status status) { + void response(int32_t id, Status status, const std::string& subject) { if (status) { - Raul::error(Raul::fmt("error on message %1%: %2%\n") - % id % ingen_status_string(status)); + Raul::error(Raul::fmt("error on message %1%: %2% (%3)\n") + % id % ingen_status_string(status) % subject); exit(EXIT_FAILURE); } } |