From 8c98e7e907bf8139193436a3af44a5ecf7f74b80 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 22 Feb 2010 23:07:21 +0000 Subject: Don't respond with PUT (creating empty nodes) when plugin instantiation fails. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2479 a436a847-0d15-0410-975c-d299462d15a1 --- src/engine/Event.hpp | 4 ++++ src/engine/events/Connect.cpp | 1 - src/engine/events/Connect.hpp | 2 -- src/engine/events/CreateNode.cpp | 4 ++++ src/engine/events/CreatePatch.cpp | 1 - src/engine/events/CreatePatch.hpp | 1 - src/engine/events/CreatePort.cpp | 1 - src/engine/events/CreatePort.hpp | 1 - src/engine/events/Disconnect.cpp | 2 -- src/engine/events/Disconnect.hpp | 1 - src/engine/events/DisconnectAll.cpp | 2 -- src/engine/events/DisconnectAll.hpp | 1 - src/engine/events/Move.cpp | 1 - src/engine/events/Move.hpp | 1 - src/engine/events/RequestMetadata.cpp | 1 - src/engine/events/RequestMetadata.hpp | 2 +- src/engine/events/SetMetadata.cpp | 8 ++++---- src/engine/events/SetMetadata.hpp | 5 +++-- src/engine/events/SetPortValue.cpp | 2 -- src/engine/events/SetPortValue.hpp | 1 - 20 files changed, 16 insertions(+), 26 deletions(-) diff --git a/src/engine/Event.hpp b/src/engine/Event.hpp index bac8464a..3fda3fd8 100644 --- a/src/engine/Event.hpp +++ b/src/engine/Event.hpp @@ -56,17 +56,21 @@ public: inline SampleCount time() const { return _time; } + int error() { return _error; } + protected: Event(Engine& engine, SharedPtr request, FrameTime time) : _engine(engine) , _request(request) , _time(time) + , _error(0) // success , _executed(false) {} Engine& _engine; SharedPtr _request; FrameTime _time; + int _error; bool _executed; }; diff --git a/src/engine/events/Connect.cpp b/src/engine/events/Connect.cpp index cc870c04..6d096bbd 100644 --- a/src/engine/events/Connect.cpp +++ b/src/engine/events/Connect.cpp @@ -53,7 +53,6 @@ Connect::Connect(Engine& engine, SharedPtr request, SampleCount timesta , _patch_listnode(NULL) , _port_listnode(NULL) , _buffers(NULL) - , _error(NO_ERROR) { } diff --git a/src/engine/events/Connect.hpp b/src/engine/events/Connect.hpp index 116ea892..90fba0d9 100644 --- a/src/engine/events/Connect.hpp +++ b/src/engine/events/Connect.hpp @@ -82,8 +82,6 @@ private: InputPort::Connections::Node* _port_listnode; Raul::Array* _buffers; - - ErrorType _error; }; diff --git a/src/engine/events/CreateNode.cpp b/src/engine/events/CreateNode.cpp index 37adda6b..bd1412a2 100644 --- a/src/engine/events/CreateNode.cpp +++ b/src/engine/events/CreateNode.cpp @@ -113,6 +113,10 @@ CreateNode::pre_process() _compiled_patch = _patch->compile(); } } + + if (!_node) + _error = 1; + QueuedEvent::pre_process(); } diff --git a/src/engine/events/CreatePatch.cpp b/src/engine/events/CreatePatch.cpp index f832c9fe..5f87d605 100644 --- a/src/engine/events/CreatePatch.cpp +++ b/src/engine/events/CreatePatch.cpp @@ -50,7 +50,6 @@ CreatePatch::CreatePatch( , _parent(NULL) , _compiled_patch(NULL) , _poly(poly) - , _error(NO_ERROR) , _properties(properties) { } diff --git a/src/engine/events/CreatePatch.hpp b/src/engine/events/CreatePatch.hpp index 2db36d35..2ef6ad95 100644 --- a/src/engine/events/CreatePatch.hpp +++ b/src/engine/events/CreatePatch.hpp @@ -56,7 +56,6 @@ private: PatchImpl* _parent; CompiledPatch* _compiled_patch; int _poly; - ErrorType _error; Shared::Resource::Properties _properties; }; diff --git a/src/engine/events/CreatePort.cpp b/src/engine/events/CreatePort.cpp index 33a7f810..7d8f9d16 100644 --- a/src/engine/events/CreatePort.cpp +++ b/src/engine/events/CreatePort.cpp @@ -52,7 +52,6 @@ CreatePort::CreatePort( bool is_output, const Resource::Properties& properties) : QueuedEvent(engine, request, timestamp, bool(request)) - , _error(NO_ERROR) , _path(path) , _type(type) , _is_output(is_output) diff --git a/src/engine/events/CreatePort.hpp b/src/engine/events/CreatePort.hpp index 350a6b93..37a4f82f 100644 --- a/src/engine/events/CreatePort.hpp +++ b/src/engine/events/CreatePort.hpp @@ -61,7 +61,6 @@ private: CREATION_FAILED }; - ErrorType _error; Raul::Path _path; Raul::URI _type; bool _is_output; diff --git a/src/engine/events/Disconnect.cpp b/src/engine/events/Disconnect.cpp index 7454959e..653933b7 100644 --- a/src/engine/events/Disconnect.cpp +++ b/src/engine/events/Disconnect.cpp @@ -54,7 +54,6 @@ Disconnect::Disconnect( , _patch_connection(NULL) , _compiled_patch(NULL) , _buffers(NULL) - , _error(NO_ERROR) , _internal(false) , _reconnect_dst_port(true) , _clear_dst_port(false) @@ -77,7 +76,6 @@ Disconnect::Disconnect( , _dst_port(dst_port) , _compiled_patch(NULL) , _buffers(NULL) - , _error(NO_ERROR) , _internal(true) , _reconnect_dst_port(reconnect_dst_port) , _clear_dst_port(false) diff --git a/src/engine/events/Disconnect.hpp b/src/engine/events/Disconnect.hpp index 92f1bbc8..3a8758ec 100644 --- a/src/engine/events/Disconnect.hpp +++ b/src/engine/events/Disconnect.hpp @@ -91,7 +91,6 @@ private: Raul::Array* _buffers; - ErrorType _error; bool _internal; bool _reconnect_dst_port; bool _clear_dst_port; diff --git a/src/engine/events/DisconnectAll.cpp b/src/engine/events/DisconnectAll.cpp index 56bef36a..38ed7102 100644 --- a/src/engine/events/DisconnectAll.cpp +++ b/src/engine/events/DisconnectAll.cpp @@ -49,7 +49,6 @@ DisconnectAll::DisconnectAll(Engine& engine, SharedPtr request, SampleC , _node(NULL) , _port(NULL) , _compiled_patch(NULL) - , _error(NO_ERROR) , _deleting(false) { } @@ -65,7 +64,6 @@ DisconnectAll::DisconnectAll(Engine& engine, PatchImpl* parent, GraphObjectImpl* , _node(dynamic_cast(object)) , _port(dynamic_cast(object)) , _compiled_patch(NULL) - , _error(NO_ERROR) , _deleting(true) { } diff --git a/src/engine/events/DisconnectAll.hpp b/src/engine/events/DisconnectAll.hpp index 47f5576a..f586e91d 100644 --- a/src/engine/events/DisconnectAll.hpp +++ b/src/engine/events/DisconnectAll.hpp @@ -76,7 +76,6 @@ private: CompiledPatch* _compiled_patch; ///< New process order for Patch - ErrorType _error; bool _deleting; }; diff --git a/src/engine/events/Move.cpp b/src/engine/events/Move.cpp index 822061f2..949590e7 100644 --- a/src/engine/events/Move.cpp +++ b/src/engine/events/Move.cpp @@ -40,7 +40,6 @@ Move::Move(Engine& engine, SharedPtr request, SampleCount timestamp, co , _new_path(new_path) , _parent_patch(NULL) , _store_iterator(engine.engine_store()->end()) - , _error(NO_ERROR) { } diff --git a/src/engine/events/Move.hpp b/src/engine/events/Move.hpp index 9f9f8401..90f365c4 100644 --- a/src/engine/events/Move.hpp +++ b/src/engine/events/Move.hpp @@ -70,7 +70,6 @@ private: Raul::Path _new_path; PatchImpl* _parent_patch; EngineStore::iterator _store_iterator; - ErrorType _error; }; diff --git a/src/engine/events/RequestMetadata.cpp b/src/engine/events/RequestMetadata.cpp index 17c39585..707398bd 100644 --- a/src/engine/events/RequestMetadata.cpp +++ b/src/engine/events/RequestMetadata.cpp @@ -46,7 +46,6 @@ RequestMetadata::RequestMetadata(Engine& engine, const URI& subject, const URI& key) : QueuedEvent(engine, request, timestamp) - , _error(NO_ERROR) , _special_type(NONE) , _uri(subject) , _key(key) diff --git a/src/engine/events/RequestMetadata.hpp b/src/engine/events/RequestMetadata.hpp index 60da3cb7..472e79c3 100644 --- a/src/engine/events/RequestMetadata.hpp +++ b/src/engine/events/RequestMetadata.hpp @@ -56,7 +56,7 @@ public: void post_process(); private: - enum { NO_ERROR, NOT_FOUND } _error; + enum ErrorType { NO_ERROR, NOT_FOUND }; enum { NONE, PORT_VALUE diff --git a/src/engine/events/SetMetadata.cpp b/src/engine/events/SetMetadata.cpp index 70463aa6..fefc7835 100644 --- a/src/engine/events/SetMetadata.cpp +++ b/src/engine/events/SetMetadata.cpp @@ -58,7 +58,6 @@ SetMetadata::SetMetadata( const Properties& properties, const Properties& remove) : QueuedEvent(engine, request, timestamp, false) - , _error(NO_ERROR) , _create_event(NULL) , _subject(subject) , _properties(properties) @@ -347,13 +346,14 @@ SetMetadata::post_process() switch (_error) { case NO_ERROR: - _request->respond_ok(); + if (_create_event) + _create_event->post_process(); + else + _request->respond_ok(); if (_create) _engine.broadcaster()->put(_subject, _properties); else _engine.broadcaster()->delta(_subject, _remove, _properties); - if (_create_event) - _create_event->post_process(); break; case NOT_FOUND: _request->respond_error((boost::format( diff --git a/src/engine/events/SetMetadata.hpp b/src/engine/events/SetMetadata.hpp index b4b1d0ef..ee7d9d42 100644 --- a/src/engine/events/SetMetadata.hpp +++ b/src/engine/events/SetMetadata.hpp @@ -82,12 +82,13 @@ public: void post_process(); private: - enum { NO_ERROR, + enum ErrorType { + NO_ERROR, NOT_FOUND, INTERNAL, BAD_OBJECT_TYPE, BAD_VALUE_TYPE - } _error; + }; enum SpecialType { NONE, diff --git a/src/engine/events/SetPortValue.cpp b/src/engine/events/SetPortValue.cpp index d919814e..2ad94082 100644 --- a/src/engine/events/SetPortValue.cpp +++ b/src/engine/events/SetPortValue.cpp @@ -58,7 +58,6 @@ SetPortValue::SetPortValue(Engine& engine, , _port_path(port_path) , _value(value) , _port(NULL) - , _error(NO_ERROR) { } @@ -74,7 +73,6 @@ SetPortValue::SetPortValue(Engine& engine, , _port_path(port->path()) , _value(value) , _port(port) - , _error(NO_ERROR) { } diff --git a/src/engine/events/SetPortValue.hpp b/src/engine/events/SetPortValue.hpp index 5d4265c7..117e8eed 100644 --- a/src/engine/events/SetPortValue.hpp +++ b/src/engine/events/SetPortValue.hpp @@ -74,7 +74,6 @@ private: const Raul::Path _port_path; const Raul::Atom _value; PortImpl* _port; - ErrorType _error; }; -- cgit v1.2.1