summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/server/Engine.cpp12
-rw-r--r--src/server/Event.cpp18
-rw-r--r--src/server/Event.hpp47
-rw-r--r--src/server/Request.hpp73
-rw-r--r--src/server/ServerInterfaceImpl.cpp59
-rw-r--r--src/server/ServerInterfaceImpl.hpp7
-rw-r--r--src/server/events/Connect.cpp18
-rw-r--r--src/server/events/Connect.hpp11
-rw-r--r--src/server/events/CreateNode.cpp31
-rw-r--r--src/server/events/CreateNode.hpp14
-rw-r--r--src/server/events/CreatePatch.cpp69
-rw-r--r--src/server/events/CreatePatch.hpp14
-rw-r--r--src/server/events/CreatePort.cpp29
-rw-r--r--src/server/events/CreatePort.hpp14
-rw-r--r--src/server/events/Deactivate.hpp9
-rw-r--r--src/server/events/Delete.cpp24
-rw-r--r--src/server/events/Delete.hpp9
-rw-r--r--src/server/events/Disconnect.cpp20
-rw-r--r--src/server/events/Disconnect.hpp11
-rw-r--r--src/server/events/DisconnectAll.cpp47
-rw-r--r--src/server/events/DisconnectAll.hpp21
-rw-r--r--src/server/events/Get.cpp32
-rw-r--r--src/server/events/Get.hpp9
-rw-r--r--src/server/events/Move.cpp14
-rw-r--r--src/server/events/Move.hpp13
-rw-r--r--src/server/events/Ping.hpp10
-rw-r--r--src/server/events/RegisterClient.cpp24
-rw-r--r--src/server/events/RegisterClient.hpp13
-rw-r--r--src/server/events/SetMetadata.cpp49
-rw-r--r--src/server/events/SetMetadata.hpp18
-rw-r--r--src/server/events/SetPortValue.cpp38
-rw-r--r--src/server/events/SetPortValue.hpp24
-rw-r--r--src/server/events/UnregisterClient.cpp13
-rw-r--r--src/server/events/UnregisterClient.hpp9
-rw-r--r--src/server/ingen_jack.cpp7
35 files changed, 395 insertions, 435 deletions
diff --git a/src/server/Engine.cpp b/src/server/Engine.cpp
index c3c73468..eb7792f5 100644
--- a/src/server/Engine.cpp
+++ b/src/server/Engine.cpp
@@ -186,9 +186,9 @@ Engine::activate()
in_properties.insert(make_pair(uris.ingenui_canvas_y,
Resource::Property(32.0f, Resource::EXTERNAL)));
- execute_and_delete_event(context, new Events::CreatePort(
- *this, SharedPtr<Request>(), 0,
- "/control_in", false, in_properties));
+ execute_and_delete_event(
+ context, new Events::CreatePort(*this, NULL, -1, 0,
+ "/control_in", false, in_properties));
// Add control out
Resource::Properties out_properties(control_properties);
@@ -202,9 +202,9 @@ Engine::activate()
out_properties.insert(make_pair(uris.ingenui_canvas_y,
Resource::Property(32.0f, Resource::EXTERNAL)));
- execute_and_delete_event(context, new Events::CreatePort(
- *this, SharedPtr<Request>(), 0,
- "/control_out", true, out_properties));
+ execute_and_delete_event(
+ context, new Events::CreatePort(*this, NULL, -1, 0,
+ "/control_out", true, out_properties));
}
_driver->activate();
diff --git a/src/server/Event.cpp b/src/server/Event.cpp
index d69de2b9..76932550 100644
--- a/src/server/Event.cpp
+++ b/src/server/Event.cpp
@@ -15,6 +15,8 @@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#include "ingen/ClientInterface.hpp"
+
#include "Driver.hpp"
#include "Engine.hpp"
#include "Event.hpp"
@@ -60,5 +62,21 @@ Event::post_process()
ThreadManager::assert_not_thread(THREAD_PROCESS);
}
+void
+Event::respond_ok()
+{
+ if (_request_client) {
+ _request_client->response_ok(_request_id);
+ }
+}
+
+void
+Event::respond_error(const std::string& msg)
+{
+ if (_request_client) {
+ _request_client->response_error(_request_id, msg);
+ }
+}
+
} // namespace Server
} // namespace Ingen
diff --git a/src/server/Event.hpp b/src/server/Event.hpp
index 64e93b8b..f887ce66 100644
--- a/src/server/Event.hpp
+++ b/src/server/Event.hpp
@@ -18,20 +18,21 @@
#ifndef INGEN_ENGINE_EVENT_HPP
#define INGEN_ENGINE_EVENT_HPP
-#include <cassert>
-
-#include "raul/SharedPtr.hpp"
+#include "raul/AtomicPtr.hpp"
#include "raul/Deletable.hpp"
+#include "raul/Noncopyable.hpp"
#include "raul/Path.hpp"
-#include "raul/AtomicPtr.hpp"
+#include "raul/SharedPtr.hpp"
#include "types.hpp"
namespace Ingen {
+
+class ClientInterface;
+
namespace Server {
class Engine;
-class Request;
class ProcessContext;
/** An event (command) to perform some action on Ingen.
@@ -46,7 +47,7 @@ class ProcessContext;
*
* \ingroup engine
*/
-class Event : public Raul::Deletable
+class Event : public Raul::Deletable, public Raul::Noncopyable
{
public:
virtual ~Event() {}
@@ -60,19 +61,32 @@ public:
/** Post-process event after execution (non-realtime). */
virtual void post_process();
- inline bool is_prepared() const { return _pre_processed; }
- inline SampleCount time() const { return _time; }
+ /** Return true iff this event has been pre-processed. */
+ inline bool is_prepared() const { return _pre_processed; }
+
+ /** Return the time stamp of this event. */
+ inline SampleCount time() const { return _time; }
+
+ /** Get the next event to be processed after this one. */
+ Event* next() const { return _next.get(); }
+
+ /** Set the next event to be processed after this one. */
+ void next(Event* ev) { _next = ev; }
- /** Get the next event in the event process list. */
- Event* next() const { return _next.get(); }
- void next(Event* ev) { _next = ev; }
+ /** Return the error status of this event. */
+ int error() const { return _error; }
- int error() { return _error; }
+ /** Respond to the originating client successfully. */
+ void respond_ok();
+ /** Respond to the originating client with an error. */
+ void respond_error(const std::string& msg);
+
protected:
- Event(Engine& engine, SharedPtr<Request> request, FrameTime time)
+ Event(Engine& engine, ClientInterface* client, int32_t id, FrameTime time)
: _engine(engine)
- , _request(request)
+ , _request_client(client)
+ , _request_id(id)
, _time(time)
, _error(0) // success
, _pre_processed(false)
@@ -82,6 +96,8 @@ protected:
/** Constructor for internal events only */
explicit Event(Engine& engine)
: _engine(engine)
+ , _request_client(NULL)
+ , _request_id(-1)
, _time(0)
, _error(0) // success
, _pre_processed(false)
@@ -89,8 +105,9 @@ protected:
{}
Engine& _engine;
- SharedPtr<Request> _request;
Raul::AtomicPtr<Event> _next;
+ ClientInterface* _request_client;
+ int32_t _request_id;
FrameTime _time;
int _error;
bool _pre_processed;
diff --git a/src/server/Request.hpp b/src/server/Request.hpp
deleted file mode 100644
index 49546b7f..00000000
--- a/src/server/Request.hpp
+++ /dev/null
@@ -1,73 +0,0 @@
-/* This file is part of Ingen.
- * Copyright 2007-2011 David Robillard <http://drobilla.net>
- *
- * Ingen is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option) any later
- * version.
- *
- * Ingen is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef INGEN_ENGINE_REQUEST_HPP
-#define INGEN_ENGINE_REQUEST_HPP
-
-#include <inttypes.h>
-
-#include <string>
-
-#include "ingen/ClientInterface.hpp"
-
-namespace Ingen {
-namespace Server {
-
-/** Record of a request (used to respond to clients).
- *
- * This is a glorified std::pair<ClientInterface*, int32_t> for replying
- * to numbered messages from a client.
- *
- * For responses that involve several messages, the response will come first
- * followed by the messages (eg object notifications, values, errors, etc.)
- * in a bundle (or "transfer" if too large).
- */
-class Request
-{
-public:
- Request(ClientInterface* client=0,
- int32_t id=1)
- : _client(client)
- , _id(id)
- {}
-
- int32_t id() const { return _id; }
- void set_id(int32_t id) { _id = id; }
-
- ClientInterface* client() const { return _client; }
- void set_client(ClientInterface* client) { _client = client; }
-
- void respond_ok() {
- if (_client)
- _client->response_ok(_id);
- }
-
- void respond_error(const std::string& msg) {
- if (_client)
- _client->response_error(_id, msg);
- }
-
-private:
- ClientInterface* _client;
- int32_t _id;
-};
-
-} // namespace Server
-} // namespace Ingen
-
-#endif // INGEN_ENGINE_REQUEST_HPP
-
diff --git a/src/server/ServerInterfaceImpl.cpp b/src/server/ServerInterfaceImpl.cpp
index bc9e56c4..9cc48aa9 100644
--- a/src/server/ServerInterfaceImpl.cpp
+++ b/src/server/ServerInterfaceImpl.cpp
@@ -35,7 +35,8 @@ namespace Server {
ServerInterfaceImpl::ServerInterfaceImpl(Engine& engine)
: EventSource()
- , _request(new Request(NULL, 0))
+ , _request_client(NULL)
+ , _request_id(-1)
, _engine(engine)
, _in_bundle(false)
{
@@ -62,17 +63,15 @@ ServerInterfaceImpl::now() const
void
ServerInterfaceImpl::respond_to(ClientInterface* client, int32_t id)
{
- if (_request) {
- _request->set_client(client);
- _request->set_id(id);
- }
+ _request_client = client;
+ _request_id = id;
}
void
ServerInterfaceImpl::disable_responses()
{
- _request->set_client(NULL);
- _request->set_id(0);
+ _request_client = NULL;
+ _request_id = -1;
}
/* *** ServerInterface implementation below here *** */
@@ -80,23 +79,17 @@ ServerInterfaceImpl::disable_responses()
void
ServerInterfaceImpl::register_client(ClientInterface* client)
{
- push_queued(new Events::RegisterClient(_engine, _request, now(), client->uri(), client));
- if (!_request) {
- _request = SharedPtr<Request>(new Request(client, 1));
- } else {
- _request->set_id(1);
- _request->set_client(client);
- }
+ push_queued(new Events::RegisterClient(_engine, client, _request_id, now(), client->uri()));
+ _request_client = client;
+ _request_id = 1;
}
void
ServerInterfaceImpl::unregister_client(const URI& uri)
{
- push_queued(new Events::UnregisterClient(_engine, _request, now(), uri));
- if (_request && _request->client() && _request->client()->uri() == uri) {
- _request->set_id(0);
- _request->set_client(NULL);
- }
+ push_queued(new Events::UnregisterClient(_engine, _request_client, _request_id, now(), uri));
+ _request_client = NULL;
+ _request_id = -1;
}
// Bundle commands
@@ -120,7 +113,7 @@ ServerInterfaceImpl::put(const URI& uri,
const Resource::Properties& properties,
const Resource::Graph ctx)
{
- push_queued(new Events::SetMetadata(_engine, _request, now(), true, ctx, uri, properties));
+ push_queued(new Events::SetMetadata(_engine, _request_client, _request_id, now(), true, ctx, uri, properties));
}
void
@@ -128,24 +121,26 @@ ServerInterfaceImpl::delta(const URI& uri,
const Resource::Properties& remove,
const Resource::Properties& add)
{
- push_queued(new Events::SetMetadata(_engine, _request, now(), false, Resource::DEFAULT, uri, add, remove));
+ push_queued(new Events::SetMetadata(_engine, _request_client, _request_id, now(), false, Resource::DEFAULT, uri, add, remove));
}
void
ServerInterfaceImpl::move(const Path& old_path,
const Path& new_path)
{
- push_queued(new Events::Move(_engine, _request, now(), old_path, new_path));
+ push_queued(new Events::Move(_engine, _request_client, _request_id, now(), old_path, new_path));
}
void
ServerInterfaceImpl::del(const URI& uri)
{
if (uri == "ingen:engine") {
- _request->respond_ok();
+ if (_request_client) {
+ _request_client->response_ok(_request_id);
+ }
_engine.quit();
} else {
- push_queued(new Events::Delete(_engine, _request, now(), uri));
+ push_queued(new Events::Delete(_engine, _request_client, _request_id, now(), uri));
}
}
@@ -153,7 +148,7 @@ void
ServerInterfaceImpl::connect(const Path& src_port_path,
const Path& dst_port_path)
{
- push_queued(new Events::Connect(_engine, _request, now(), src_port_path, dst_port_path));
+ push_queued(new Events::Connect(_engine, _request_client, _request_id, now(), src_port_path, dst_port_path));
}
@@ -166,7 +161,7 @@ ServerInterfaceImpl::disconnect(const URI& src,
return;
}
- push_queued(new Events::Disconnect(_engine, _request, now(),
+ push_queued(new Events::Disconnect(_engine, _request_client, _request_id, now(),
Path(src.str()), Path(dst.str())));
}
@@ -174,7 +169,7 @@ void
ServerInterfaceImpl::disconnect_all(const Path& patch_path,
const Path& path)
{
- push_queued(new Events::DisconnectAll(_engine, _request, now(), patch_path, path));
+ push_queued(new Events::DisconnectAll(_engine, _request_client, _request_id, now(), patch_path, path));
}
void
@@ -186,9 +181,9 @@ ServerInterfaceImpl::set_property(const URI& uri,
&& value.type() == Atom::BOOL) {
if (value.get_bool()) {
_engine.activate();
- push_queued(new Events::Ping(_engine, _request, now()));
+ push_queued(new Events::Ping(_engine, _request_client, _request_id, now()));
} else {
- push_queued(new Events::Deactivate(_engine, _request, now()));
+ push_queued(new Events::Deactivate(_engine, _request_client, _request_id, now()));
}
} else {
Resource::Properties remove;
@@ -196,7 +191,7 @@ ServerInterfaceImpl::set_property(const URI& uri,
Resource::Properties add;
add.insert(make_pair(predicate, value));
push_queued(new Events::SetMetadata(
- _engine, _request, now(), false, Resource::DEFAULT,
+ _engine, _request_client, _request_id, now(), false, Resource::DEFAULT,
uri, add, remove));
}
}
@@ -206,13 +201,13 @@ ServerInterfaceImpl::set_property(const URI& uri,
void
ServerInterfaceImpl::ping()
{
- push_queued(new Events::Ping(_engine, _request, now()));
+ push_queued(new Events::Ping(_engine, _request_client, _request_id, now()));
}
void
ServerInterfaceImpl::get(const URI& uri)
{
- push_queued(new Events::Get(_engine, _request, now(), uri));
+ push_queued(new Events::Get(_engine, _request_client, _request_id, now(), uri));
}
} // namespace Server
diff --git a/src/server/ServerInterfaceImpl.hpp b/src/server/ServerInterfaceImpl.hpp
index ba96d051..b43549ef 100644
--- a/src/server/ServerInterfaceImpl.hpp
+++ b/src/server/ServerInterfaceImpl.hpp
@@ -26,7 +26,6 @@
#include "ingen/ServerInterface.hpp"
#include "ingen/Resource.hpp"
#include "EventSource.hpp"
-#include "Request.hpp"
#include "types.hpp"
namespace Ingen {
@@ -98,11 +97,9 @@ public:
virtual void ping();
virtual void get(const Raul::URI& uri);
- SharedPtr<Request> request() { return _request; }
- void set_request(SharedPtr<Request> r) { _request = r; }
-
protected:
- SharedPtr<Request> _request; ///< NULL if responding disabled
+ ClientInterface* _request_client;
+ int32_t _request_id;
Engine& _engine;
bool _in_bundle; ///< True iff a bundle is currently being received
diff --git a/src/server/events/Connect.cpp b/src/server/events/Connect.cpp
index c8858961..aae84b39 100644
--- a/src/server/events/Connect.cpp
+++ b/src/server/events/Connect.cpp
@@ -34,7 +34,6 @@
#include "PatchImpl.hpp"
#include "PortImpl.hpp"
#include "ProcessContext.hpp"
-#include "Request.hpp"
#include "types.hpp"
using namespace std;
@@ -44,12 +43,13 @@ namespace Ingen {
namespace Server {
namespace Events {
-Connect::Connect(Engine& engine,
- SharedPtr<Request> request,
- SampleCount timestamp,
- const Path& src_port_path,
- const Path& dst_port_path)
- : Event(engine, request, timestamp)
+Connect::Connect(Engine& engine,
+ ClientInterface* client,
+ int32_t id,
+ SampleCount timestamp,
+ const Path& src_port_path,
+ const Path& dst_port_path)
+ : Event(engine, client, id, timestamp)
, _src_port_path(src_port_path)
, _dst_port_path(dst_port_path)
, _patch(NULL)
@@ -177,7 +177,7 @@ Connect::post_process()
{
std::ostringstream ss;
if (_error == NO_ERROR) {
- _request->respond_ok();
+ respond_ok();
_engine.broadcaster()->connect(_src_port_path, _dst_port_path);
return;
}
@@ -202,7 +202,7 @@ Connect::post_process()
ss << "Unknown error";
}
ss << ")";
- _request->respond_error(ss.str());
+ respond_error(ss.str());
}
} // namespace Events
diff --git a/src/server/events/Connect.hpp b/src/server/events/Connect.hpp
index 3b9e64a3..92f8bcf4 100644
--- a/src/server/events/Connect.hpp
+++ b/src/server/events/Connect.hpp
@@ -49,11 +49,12 @@ namespace Events {
class Connect : public Event
{
public:
- Connect(Engine& engine,
- SharedPtr<Request> request,
- SampleCount timestamp,
- const Raul::Path& src_port_path,
- const Raul::Path& dst_port_path);
+ Connect(Engine& engine,
+ ClientInterface* client,
+ int32_t id,
+ SampleCount timestamp,
+ const Raul::Path& src_port_path,
+ const Raul::Path& dst_port_path);
void pre_process();
void execute(ProcessContext& context);
diff --git a/src/server/events/CreateNode.cpp b/src/server/events/CreateNode.cpp
index e827f840..04fef8b1 100644
--- a/src/server/events/CreateNode.cpp
+++ b/src/server/events/CreateNode.cpp
@@ -21,7 +21,6 @@
#include "sord/sordmm.hpp"
#include "ingen/shared/LV2URIMap.hpp"
#include "CreateNode.hpp"
-#include "Request.hpp"
#include "PatchImpl.hpp"
#include "NodeImpl.hpp"
#include "PluginImpl.hpp"
@@ -40,14 +39,14 @@ namespace Ingen {
namespace Server {
namespace Events {
-CreateNode::CreateNode(
- Engine& engine,
- SharedPtr<Request> request,
- SampleCount timestamp,
- const Path& path,
- const URI& plugin_uri,
- const Resource::Properties& properties)
- : Event(engine, request, timestamp)
+CreateNode::CreateNode(Engine& engine,
+ ClientInterface* client,
+ int32_t id,
+ SampleCount timestamp,
+ const Path& path,
+ const URI& plugin_uri,
+ const Resource::Properties& properties)
+ : Event(engine, client, id, timestamp)
, _path(path)
, _plugin_uri(plugin_uri)
, _patch(NULL)
@@ -117,26 +116,22 @@ CreateNode::execute(ProcessContext& context)
void
CreateNode::post_process()
{
- if (!_request) {
- return;
- }
-
string msg;
if (_node_already_exists) {
msg = string("Could not create node - ").append(_path.str());// + " already exists.";
- _request->respond_error(msg);
+ respond_error(msg);
} else if (_patch == NULL) {
msg = "Could not find patch '" + _path.parent().str() +"' to add node.";
- _request->respond_error(msg);
+ respond_error(msg);
} else if (_plugin == NULL) {
msg = "Unable to load node ";
msg += _path.str() + " (you're missing the plugin " + _plugin_uri.str() + ")";
- _request->respond_error(msg);
+ respond_error(msg);
} else if (_node == NULL) {
msg = "Failed to instantiate plugin " + _plugin_uri.str();
- _request->respond_error(msg);
+ respond_error(msg);
} else {
- _request->respond_ok();
+ respond_ok();
_engine.broadcaster()->send_object(_node, true); // yes, send ports
}
}
diff --git a/src/server/events/CreateNode.hpp b/src/server/events/CreateNode.hpp
index b01af7cc..0a89ba02 100644
--- a/src/server/events/CreateNode.hpp
+++ b/src/server/events/CreateNode.hpp
@@ -41,13 +41,13 @@ namespace Events {
class CreateNode : public Event
{
public:
- CreateNode(
- Engine& engine,
- SharedPtr<Request> request,
- SampleCount timestamp,
- const Raul::Path& node_path,
- const Raul::URI& plugin_uri,
- const Resource::Properties& properties);
+ CreateNode(Engine& engine,
+ ClientInterface* client,
+ int32_t id,
+ SampleCount timestamp,
+ const Raul::Path& node_path,
+ const Raul::URI& plugin_uri,
+ const Resource::Properties& properties);
void pre_process();
void execute(ProcessContext& context);
diff --git a/src/server/events/CreatePatch.cpp b/src/server/events/CreatePatch.cpp
index 2abe5d22..eda05ccd 100644
--- a/src/server/events/CreatePatch.cpp
+++ b/src/server/events/CreatePatch.cpp
@@ -19,7 +19,6 @@
#include "raul/Path.hpp"
#include "ingen/shared/LV2URIMap.hpp"
#include "events/CreatePatch.hpp"
-#include "Request.hpp"
#include "PatchImpl.hpp"
#include "NodeImpl.hpp"
#include "PluginImpl.hpp"
@@ -35,14 +34,14 @@ namespace Ingen {
namespace Server {
namespace Events {
-CreatePatch::CreatePatch(
- Engine& engine,
- SharedPtr<Request> request,
- SampleCount timestamp,
- const Raul::Path& path,
- int poly,
- const Resource::Properties& properties)
- : Event(engine, request, timestamp)
+CreatePatch::CreatePatch(Engine& engine,
+ ClientInterface* client,
+ int32_t id,
+ SampleCount timestamp,
+ const Raul::Path& path,
+ int poly,
+ const Resource::Properties& properties)
+ : Event(engine, client, id, timestamp)
, _path(path)
, _patch(NULL)
, _parent(NULL)
@@ -128,33 +127,31 @@ void
CreatePatch::post_process()
{
string msg;
- if (_request) {
- switch (_error) {
- case NO_ERROR:
- _request->respond_ok();
- // Don't send ports/nodes that have been added since prepare()
- // (otherwise they would be sent twice)
- _engine.broadcaster()->send_object(_patch, false);
- break;
- case OBJECT_EXISTS:
- _request->respond_ok();
- /*string msg = "Unable to create patch: ";
- msg.append(_path).append(" already exists.");
- _request->respond_error(msg);*/
- break;
- case PARENT_NOT_FOUND:
- msg = "Unable to create patch: Parent ";
- msg.append(Path(_path).parent().str()).append(" not found.");
- _request->respond_error(msg);
- break;
- case INVALID_POLY:
- msg = "Unable to create patch ";
- msg.append(_path.str()).append(": ").append("Invalid polyphony requested.");
- _request->respond_error(msg);
- break;
- default:
- _request->respond_error("Unable to load patch.");
- }
+ switch (_error) {
+ case NO_ERROR:
+ respond_ok();
+ // Don't send ports/nodes that have been added since prepare()
+ // (otherwise they would be sent twice)
+ _engine.broadcaster()->send_object(_patch, false);
+ break;
+ case OBJECT_EXISTS:
+ respond_ok();
+ /*string msg = "Unable to create patch: ";
+ msg.append(_path).append(" already exists.");
+ respond_error(msg);*/
+ break;
+ case PARENT_NOT_FOUND:
+ msg = "Unable to create patch: Parent ";
+ msg.append(Path(_path).parent().str()).append(" not found.");
+ respond_error(msg);
+ break;
+ case INVALID_POLY:
+ msg = "Unable to create patch ";
+ msg.append(_path.str()).append(": ").append("Invalid polyphony requested.");
+ respond_error(msg);
+ break;
+ default:
+ respond_error("Unable to load patch.");
}
}
diff --git a/src/server/events/CreatePatch.hpp b/src/server/events/CreatePatch.hpp
index 49f0b633..4addd524 100644
--- a/src/server/events/CreatePatch.hpp
+++ b/src/server/events/CreatePatch.hpp
@@ -36,13 +36,13 @@ namespace Events {
class CreatePatch : public Event
{
public:
- CreatePatch(
- Engine& engine,
- SharedPtr<Request> request,
- SampleCount timestamp,
- const Raul::Path& path,
- int poly,
- const Resource::Properties& properties);
+ CreatePatch(Engine& engine,
+ ClientInterface* client,
+ int32_t id,
+ SampleCount timestamp,
+ const Raul::Path& path,
+ int poly,
+ const Resource::Properties& properties);
void pre_process();
void execute(ProcessContext& context);
diff --git a/src/server/events/CreatePort.cpp b/src/server/events/CreatePort.cpp
index 0a200add..1df393ca 100644
--- a/src/server/events/CreatePort.cpp
+++ b/src/server/events/CreatePort.cpp
@@ -31,7 +31,6 @@
#include "PatchImpl.hpp"
#include "PluginImpl.hpp"
#include "PortImpl.hpp"
-#include "Request.hpp"
using namespace std;
using namespace Raul;
@@ -40,14 +39,14 @@ namespace Ingen {
namespace Server {
namespace Events {
-CreatePort::CreatePort(
- Engine& engine,
- SharedPtr<Request> request,
- SampleCount timestamp,
- const Raul::Path& path,
- bool is_output,
- const Resource::Properties& properties)
- : Event(engine, request, timestamp)
+CreatePort::CreatePort(Engine& engine,
+ ClientInterface* client,
+ int32_t id,
+ SampleCount timestamp,
+ const Raul::Path& path,
+ bool is_output,
+ const Resource::Properties& properties)
+ : Event(engine, client, id, timestamp)
, _path(path)
, _data_type(PortType::UNKNOWN)
, _patch(NULL)
@@ -174,27 +173,23 @@ CreatePort::execute(ProcessContext& context)
void
CreatePort::post_process()
{
- if (!_request) {
- return;
- }
-
string msg;
switch (_error) {
case NO_ERROR:
- _request->respond_ok();
+ respond_ok();
_engine.broadcaster()->send_object(_patch_port, true);
break;
case BAD_INDEX:
msg = string("Could not create port ") + _path.str() + " (Illegal index given)";
- _request->respond_error(msg);
+ respond_error(msg);
break;
case UNKNOWN_TYPE:
msg = string("Could not create port ") + _path.str() + " (Unknown type)";
- _request->respond_error(msg);
+ respond_error(msg);
break;
case CREATION_FAILED:
msg = string("Could not create port ") + _path.str() + " (Creation failed)";
- _request->respond_error(msg);
+ respond_error(msg);
break;
}
}
diff --git a/src/server/events/CreatePort.hpp b/src/server/events/CreatePort.hpp
index bb3aa0e4..4113611f 100644
--- a/src/server/events/CreatePort.hpp
+++ b/src/server/events/CreatePort.hpp
@@ -42,13 +42,13 @@ namespace Events {
class CreatePort : public Event
{
public:
- CreatePort(
- Engine& engine,
- SharedPtr<Request> request,
- SampleCount timestamp,
- const Raul::Path& path,
- bool is_output,
- const Resource::Properties& properties);
+ CreatePort(Engine& engine,
+ ClientInterface* client,
+ int32_t id,
+ SampleCount timestamp,
+ const Raul::Path& path,
+ bool is_output,
+ const Resource::Properties& properties);
void pre_process();
void execute(ProcessContext& context);
diff --git a/src/server/events/Deactivate.hpp b/src/server/events/Deactivate.hpp
index 1b083f29..b99a2568 100644
--- a/src/server/events/Deactivate.hpp
+++ b/src/server/events/Deactivate.hpp
@@ -32,12 +32,15 @@ namespace Events {
class Deactivate : public Event
{
public:
- Deactivate(Engine& engine, SharedPtr<Request> request, SampleCount timestamp)
- : Event(engine, request, timestamp)
+ Deactivate(Engine& engine,
+ ClientInterface* client,
+ int32_t id,
+ SampleCount timestamp)
+ : Event(engine, client, id, timestamp)
{}
void post_process() {
- _request->respond_ok();
+ respond_ok();
_engine.deactivate();
}
};
diff --git a/src/server/events/Delete.cpp b/src/server/events/Delete.cpp
index d0fbb5fa..53d77379 100644
--- a/src/server/events/Delete.cpp
+++ b/src/server/events/Delete.cpp
@@ -28,7 +28,6 @@
#include "PatchImpl.hpp"
#include "PluginImpl.hpp"
#include "PortImpl.hpp"
-#include "Request.hpp"
using namespace std;
@@ -36,11 +35,12 @@ namespace Ingen {
namespace Server {
namespace Events {
-Delete::Delete(Engine& engine,
- SharedPtr<Request> request,
- FrameTime time,
- const Raul::URI& uri)
- : Event(engine, request, time)
+Delete::Delete(Engine& engine,
+ ClientInterface* client,
+ int32_t id,
+ FrameTime time,
+ const Raul::URI& uri)
+ : Event(engine, client, id, time)
, _uri(uri)
, _store_iterator(engine.engine_store()->end())
, _garbage(NULL)
@@ -52,8 +52,6 @@ Delete::Delete(Engine& engine,
, _disconnect_event(NULL)
, _lock(engine.engine_store()->lock(), Glib::NOT_LOCK)
{
- assert(request);
-
if (Raul::Path::is_path(uri))
_path = Raul::Path(uri.str());
}
@@ -176,14 +174,14 @@ Delete::post_process()
if (!Raul::Path::is_path(_uri)
|| _path.is_root() || _path == "path:/control_in" || _path == "path:/control_out") {
// XXX: Just ignore?
- //_request->respond_error(_path.chop_scheme() + " can not be deleted");
+ //respond_error(_path.chop_scheme() + " can not be deleted");
} else if (!_node && !_port) {
string msg = string("Could not find object ") + _path.chop_scheme() + " to delete";
- _request->respond_error(msg);
+ respond_error(msg);
} else if (_patch_node_listnode) {
assert(_node);
_node->deactivate();
- _request->respond_ok();
+ respond_ok();
_engine.broadcaster()->bundle_begin();
if (_disconnect_event)
_disconnect_event->post_process();
@@ -192,7 +190,7 @@ Delete::post_process()
_engine.maid()->push(_patch_node_listnode);
} else if (_patch_port_listnode) {
assert(_port);
- _request->respond_ok();
+ respond_ok();
_engine.broadcaster()->bundle_begin();
if (_disconnect_event)
_disconnect_event->post_process();
@@ -200,7 +198,7 @@ Delete::post_process()
_engine.broadcaster()->bundle_end();
_engine.maid()->push(_patch_port_listnode);
} else {
- _request->respond_error("Unable to delete object " + _path.chop_scheme());
+ respond_error("Unable to delete object " + _path.chop_scheme());
}
if (_driver_port)
diff --git a/src/server/events/Delete.hpp b/src/server/events/Delete.hpp
index 926ecd47..c85d6982 100644
--- a/src/server/events/Delete.hpp
+++ b/src/server/events/Delete.hpp
@@ -58,10 +58,11 @@ class DisconnectAll;
class Delete : public Event
{
public:
- Delete(Engine& engine,
- SharedPtr<Request> request,
- FrameTime timestamp,
- const Raul::URI& uri);
+ Delete(Engine& engine,
+ ClientInterface* client,
+ int32_t id,
+ FrameTime timestamp,
+ const Raul::URI& uri);
~Delete();
diff --git a/src/server/events/Disconnect.cpp b/src/server/events/Disconnect.cpp
index 5fc723b5..aa5c4edb 100644
--- a/src/server/events/Disconnect.cpp
+++ b/src/server/events/Disconnect.cpp
@@ -32,7 +32,6 @@
#include "PatchImpl.hpp"
#include "PortImpl.hpp"
#include "ProcessContext.hpp"
-#include "Request.hpp"
#include "ThreadManager.hpp"
#include "events/Disconnect.hpp"
@@ -43,12 +42,13 @@ namespace Ingen {
namespace Server {
namespace Events {
-Disconnect::Disconnect(Engine& engine,
- SharedPtr<Request> request,
- SampleCount timestamp,
- const Raul::Path& src_port_path,
- const Raul::Path& dst_port_path)
- : Event(engine, request, timestamp)
+Disconnect::Disconnect(Engine& engine,
+ ClientInterface* client,
+ int32_t id,
+ SampleCount timestamp,
+ const Raul::Path& src_port_path,
+ const Raul::Path& dst_port_path)
+ : Event(engine, client, id, timestamp)
, _src_port_path(src_port_path)
, _dst_port_path(dst_port_path)
, _patch(NULL)
@@ -227,8 +227,7 @@ void
Disconnect::post_process()
{
if (_error == NO_ERROR) {
- if (_request)
- _request->respond_ok();
+ respond_ok();
_engine.broadcaster()->disconnect(_src_port->path(), _dst_port->path());
} else {
string msg("Unable to disconnect ");
@@ -257,8 +256,7 @@ Disconnect::post_process()
break;
}
msg.append(")");
- if (_request)
- _request->respond_error(msg);
+ respond_error(msg);
}
delete _impl;
diff --git a/src/server/events/Disconnect.hpp b/src/server/events/Disconnect.hpp
index 1ecb02cf..7b26e90c 100644
--- a/src/server/events/Disconnect.hpp
+++ b/src/server/events/Disconnect.hpp
@@ -46,11 +46,12 @@ namespace Events {
class Disconnect : public Event
{
public:
- Disconnect(Engine& engine,
- SharedPtr<Request> request,
- SampleCount timestamp,
- const Raul::Path& src_port_path,
- const Raul::Path& dst_port_path);
+ Disconnect(Engine& engine,
+ ClientInterface* client,
+ int32_t id,
+ SampleCount timestamp,
+ const Raul::Path& src_port_path,
+ const Raul::Path& dst_port_path);
void pre_process();
void execute(ProcessContext& context);
diff --git a/src/server/events/DisconnectAll.cpp b/src/server/events/DisconnectAll.cpp
index fde8e214..7bd9ee96 100644
--- a/src/server/events/DisconnectAll.cpp
+++ b/src/server/events/DisconnectAll.cpp
@@ -33,7 +33,6 @@
#include "OutputPort.hpp"
#include "PatchImpl.hpp"
#include "PortImpl.hpp"
-#include "Request.hpp"
#include "events/Disconnect.hpp"
#include "events/DisconnectAll.hpp"
#include "util.hpp"
@@ -45,8 +44,13 @@ namespace Ingen {
namespace Server {
namespace Events {
-DisconnectAll::DisconnectAll(Engine& engine, SharedPtr<Request> request, SampleCount timestamp, const Path& parent_path, const Path& node_path)
- : Event(engine, request, timestamp)
+DisconnectAll::DisconnectAll(Engine& engine,
+ ClientInterface* client,
+ int32_t id,
+ SampleCount timestamp,
+ const Path& parent_path,
+ const Path& node_path)
+ : Event(engine, client, id, timestamp)
, _parent_path(parent_path)
, _path(node_path)
, _parent(NULL)
@@ -59,7 +63,9 @@ DisconnectAll::DisconnectAll(Engine& engine, SharedPtr<Request> request, SampleC
/** Internal version for use by other events.
*/
-DisconnectAll::DisconnectAll(Engine& engine, PatchImpl* parent, GraphObjectImpl* object)
+DisconnectAll::DisconnectAll(Engine& engine,
+ PatchImpl* parent,
+ GraphObjectImpl* object)
: Event(engine)
, _parent_path(parent->path())
, _path(object->path())
@@ -168,27 +174,24 @@ void
DisconnectAll::post_process()
{
if (_error == NO_ERROR) {
- if (_request)
- _request->respond_ok();
+ respond_ok();
_engine.broadcaster()->disconnect_all(_parent_path, _path);
} else {
- if (_request) {
- boost::format fmt("Unable to disconnect %1% (%2%)");
- fmt % _path;
- switch (_error) {
- case INVALID_PARENT_PATH:
- fmt % string("Invalid parent path: ").append(_parent_path.str());
- break;
- case PARENT_NOT_FOUND:
- fmt % string("Unable to find parent: ").append(_parent_path.str());
- break;
- case OBJECT_NOT_FOUND:
- fmt % string("Unable to find object");
- default:
- break;
- }
- _request->respond_error(fmt.str());
+ boost::format fmt("Unable to disconnect %1% (%2%)");
+ fmt % _path;
+ switch (_error) {
+ case INVALID_PARENT_PATH:
+ fmt % string("Invalid parent path: ").append(_parent_path.str());
+ break;
+ case PARENT_NOT_FOUND:
+ fmt % string("Unable to find parent: ").append(_parent_path.str());
+ break;
+ case OBJECT_NOT_FOUND:
+ fmt % string("Unable to find object");
+ default:
+ break;
}
+ respond_error(fmt.str());
}
}
diff --git a/src/server/events/DisconnectAll.hpp b/src/server/events/DisconnectAll.hpp
index 6d3754f0..d3f84e96 100644
--- a/src/server/events/DisconnectAll.hpp
+++ b/src/server/events/DisconnectAll.hpp
@@ -44,17 +44,16 @@ class Disconnect;
class DisconnectAll : public Event
{
public:
- DisconnectAll(
- Engine& engine,
- SharedPtr<Request> request,
- SampleCount timestamp,
- const Raul::Path& parent,
- const Raul::Path& object);
-
- DisconnectAll(
- Engine& engine,
- PatchImpl* parent,
- GraphObjectImpl* object);
+ DisconnectAll(Engine& engine,
+ ClientInterface* client,
+ int32_t id,
+ SampleCount timestamp,
+ const Raul::Path& parent,
+ const Raul::Path& object);
+
+ DisconnectAll(Engine& engine,
+ PatchImpl* parent,
+ GraphObjectImpl* object);
~DisconnectAll();
diff --git a/src/server/events/Get.cpp b/src/server/events/Get.cpp
index 7cb85db4..c13054dc 100644
--- a/src/server/events/Get.cpp
+++ b/src/server/events/Get.cpp
@@ -23,7 +23,6 @@
#include "Get.hpp"
#include "ObjectSender.hpp"
#include "PluginImpl.hpp"
-#include "Request.hpp"
using namespace Raul;
@@ -31,11 +30,12 @@ namespace Ingen {
namespace Server {
namespace Events {
-Get::Get(Engine& engine,
- SharedPtr<Request> request,
- SampleCount timestamp,
- const URI& uri)
- : Event(engine, request, timestamp)
+Get::Get(Engine& engine,
+ ClientInterface* client,
+ int32_t id,
+ SampleCount timestamp,
+ const URI& uri)
+ : Event(engine, client, id, timestamp)
, _uri(uri)
, _object(NULL)
, _plugin(NULL)
@@ -63,23 +63,23 @@ void
Get::post_process()
{
if (_uri == "ingen:plugins") {
- _request->respond_ok();
- if (_request->client()) {
- _engine.broadcaster()->send_plugins_to(_request->client(), _plugins);
+ respond_ok();
+ if (_request_client) {
+ _engine.broadcaster()->send_plugins_to(_request_client, _plugins);
}
} else if (!_object && !_plugin) {
- _request->respond_error("Unable to find object requested.");
- } else if (_request->client()) {
- _request->respond_ok();
- if (_request->client()) {
+ respond_error("Unable to find object requested.");
+ } else if (_request_client) {
+ respond_ok();
+ if (_request_client) {
if (_object) {
- ObjectSender::send_object(_request->client(), _object, true);
+ ObjectSender::send_object(_request_client, _object, true);
} else if (_plugin) {
- _request->client()->put(_uri, _plugin->properties());
+ _request_client->put(_uri, _plugin->properties());
}
}
} else {
- _request->respond_error("Unable to find client to send object.");
+ respond_error("Unable to find client to send object.");
}
_lock.release();
diff --git a/src/server/events/Get.hpp b/src/server/events/Get.hpp
index 5eb45982..919db0f9 100644
--- a/src/server/events/Get.hpp
+++ b/src/server/events/Get.hpp
@@ -39,10 +39,11 @@ namespace Events {
class Get : public Event
{
public:
- Get(Engine& engine,
- SharedPtr<Request> request,
- SampleCount timestamp,
- const Raul::URI& uri);
+ Get(Engine& engine,
+ ClientInterface* client,
+ int32_t id,
+ SampleCount timestamp,
+ const Raul::URI& uri);
void pre_process();
void post_process();
diff --git a/src/server/events/Move.cpp b/src/server/events/Move.cpp
index 10be3bc8..3991e636 100644
--- a/src/server/events/Move.cpp
+++ b/src/server/events/Move.cpp
@@ -25,7 +25,6 @@
#include "EngineStore.hpp"
#include "NodeImpl.hpp"
#include "PatchImpl.hpp"
-#include "Request.hpp"
#include "events/Move.hpp"
using namespace std;
@@ -35,8 +34,13 @@ namespace Ingen {
namespace Server {
namespace Events {
-Move::Move(Engine& engine, SharedPtr<Request> request, SampleCount timestamp, const Path& path, const Path& new_path)
- : Event(engine, request, timestamp)
+Move::Move(Engine& engine,
+ ClientInterface* client,
+ int32_t id,
+ SampleCount timestamp,
+ const Path& path,
+ const Path& new_path)
+ : Event(engine, client, id, timestamp)
, _old_path(path)
, _new_path(new_path)
, _parent_patch(NULL)
@@ -114,7 +118,7 @@ Move::post_process()
string msg = "Unable to rename object - ";
if (_error == NO_ERROR) {
- _request->respond_ok();
+ respond_ok();
_engine.broadcaster()->move(_old_path, _new_path);
} else {
if (_error == OBJECT_EXISTS)
@@ -126,7 +130,7 @@ Move::post_process()
else if (_error == PARENT_DIFFERS)
msg.append(_new_path.str()).append(" is a child of a different patch");
- _request->respond_error(msg);
+ respond_error(msg);
}
}
diff --git a/src/server/events/Move.hpp b/src/server/events/Move.hpp
index bab9d047..e8e99b25 100644
--- a/src/server/events/Move.hpp
+++ b/src/server/events/Move.hpp
@@ -45,12 +45,13 @@ namespace Events {
class Move : public Event
{
public:
- Move(
- Engine& engine,
- SharedPtr<Request> request,
- SampleCount timestamp,
- const Raul::Path& old_path,
- const Raul::Path& new_path);
+ Move(Engine& engine,
+ ClientInterface* client,
+ int32_t id,
+ SampleCount timestamp,
+ const Raul::Path& old_path,
+ const Raul::Path& new_path);
+
~Move();
void pre_process();
diff --git a/src/server/events/Ping.hpp b/src/server/events/Ping.hpp
index ad732397..5017fd12 100644
--- a/src/server/events/Ping.hpp
+++ b/src/server/events/Ping.hpp
@@ -20,7 +20,6 @@
#include "Event.hpp"
#include "types.hpp"
-#include "Request.hpp"
namespace Ingen {
namespace Server {
@@ -37,11 +36,14 @@ namespace Events {
class Ping : public Event
{
public:
- Ping(Engine& engine, SharedPtr<Request> request, SampleCount timestamp)
- : Event(engine, request, timestamp)
+ Ping(Engine& engine,
+ ClientInterface* client,
+ int32_t id,
+ SampleCount timestamp)
+ : Event(engine, client, id, timestamp)
{}
- void post_process() { _request->respond_ok(); }
+ void post_process() { respond_ok(); }
};
} // namespace Server
diff --git a/src/server/events/RegisterClient.cpp b/src/server/events/RegisterClient.cpp
index 34e7a9f3..a2c0b8be 100644
--- a/src/server/events/RegisterClient.cpp
+++ b/src/server/events/RegisterClient.cpp
@@ -18,7 +18,6 @@
#include "ClientBroadcaster.hpp"
#include "Driver.hpp"
#include "Engine.hpp"
-#include "Request.hpp"
#include "events/RegisterClient.hpp"
#include "ingen/shared/LV2URIMap.hpp"
@@ -28,21 +27,20 @@ namespace Ingen {
namespace Server {
namespace Events {
-RegisterClient::RegisterClient(Engine& engine,
- SharedPtr<Request> request,
- SampleCount timestamp,
- const URI& uri,
- ClientInterface* client)
- : Event(engine, request, timestamp)
+RegisterClient::RegisterClient(Engine& engine,
+ ClientInterface* client,
+ int32_t id,
+ SampleCount timestamp,
+ const URI& uri)
+ : Event(engine, client, id, timestamp)
, _uri(uri)
- , _client(client)
{
}
void
RegisterClient::pre_process()
{
- _engine.broadcaster()->register_client(_uri, _client);
+ _engine.broadcaster()->register_client(_uri, _request_client);
Event::pre_process();
}
@@ -50,7 +48,7 @@ RegisterClient::pre_process()
void
RegisterClient::post_process()
{
- _request->respond_ok();
+ respond_ok();
/* Tell the client the engine's sample rate (which it needs to know to
interpret control bounds for lv2:sampleRate ports). This is a bit of a
@@ -58,9 +56,9 @@ RegisterClient::post_process()
that to clients.
*/
const Ingen::Shared::URIs& uris = *_engine.world()->uris().get();
- _client->set_property(uris.ingen_engine,
- uris.ingen_sampleRate,
- int32_t(_engine.driver()->sample_rate()));
+ _request_client->set_property(uris.ingen_engine,
+ uris.ingen_sampleRate,
+ int32_t(_engine.driver()->sample_rate()));
}
} // namespace Server
diff --git a/src/server/events/RegisterClient.hpp b/src/server/events/RegisterClient.hpp
index 960e2c05..0f82a33d 100644
--- a/src/server/events/RegisterClient.hpp
+++ b/src/server/events/RegisterClient.hpp
@@ -33,18 +33,17 @@ namespace Events {
class RegisterClient : public Event
{
public:
- RegisterClient(Engine& engine,
- SharedPtr<Request> request,
- SampleCount timestamp,
- const Raul::URI& uri,
- ClientInterface* client);
+ RegisterClient(Engine& engine,
+ ClientInterface* client,
+ int32_t id,
+ SampleCount timestamp,
+ const Raul::URI& uri);
void pre_process();
void post_process();
private:
- Raul::URI _uri;
- ClientInterface* _client;
+ Raul::URI _uri;
};
} // namespace Server
diff --git a/src/server/events/SetMetadata.cpp b/src/server/events/SetMetadata.cpp
index 4133803b..4d6f6497 100644
--- a/src/server/events/SetMetadata.cpp
+++ b/src/server/events/SetMetadata.cpp
@@ -35,7 +35,6 @@
#include "PluginImpl.hpp"
#include "PortImpl.hpp"
#include "PortType.hpp"
-#include "Request.hpp"
#include "SetMetadata.hpp"
#include "SetPortValue.hpp"
#include "ingen/shared/LV2URIMap.hpp"
@@ -51,16 +50,16 @@ namespace Events {
typedef Resource::Properties Properties;
-SetMetadata::SetMetadata(
- Engine& engine,
- SharedPtr<Request> request,
- SampleCount timestamp,
- bool create,
- Resource::Graph context,
- const URI& subject,
- const Properties& properties,
- const Properties& remove)
- : Event(engine, request, timestamp)
+SetMetadata::SetMetadata(Engine& engine,
+ ClientInterface* client,
+ int32_t id,
+ SampleCount timestamp,
+ bool create,
+ Resource::Graph context,
+ const URI& subject,
+ const Properties& properties,
+ const Properties& remove)
+ : Event(engine, client, id, timestamp)
, _create_event(NULL)
, _subject(subject)
, _properties(properties)
@@ -125,23 +124,20 @@ SetMetadata::pre_process()
bool is_patch = false, is_node = false, is_port = false, is_output = false;
Shared::ResourceImpl::type(uris, _properties, is_patch, is_node, is_port, is_output);
- // Create a separate request without a source so EventSource isn't unblocked twice
- SharedPtr<Request> sub_request(new Request(_request->client(), _request->id()));
-
if (is_patch) {
uint32_t poly = 1;
iterator p = _properties.find(uris.ingen_polyphony);
if (p != _properties.end() && p->second.is_valid() && p->second.type() == Atom::INT)
poly = p->second.get_int32();
- _create_event = new CreatePatch(_engine, sub_request, _time,
- path, poly, _properties);
+ _create_event = new CreatePatch(_engine, _request_client, _request_id, _time,
+ path, poly, _properties);
} else if (is_node) {
const iterator p = _properties.find(uris.rdf_instanceOf);
- _create_event = new CreateNode(_engine, sub_request, _time,
- path, p->second.get_uri(), _properties);
+ _create_event = new CreateNode(_engine, _request_client, _request_id, _time,
+ path, p->second.get_uri(), _properties);
} else if (is_port) {
- _create_event = new CreatePort(_engine, sub_request, _time,
- path, is_output, _properties);
+ _create_event = new CreatePort(_engine, _request_client, _request_id, _time,
+ path, is_output, _properties);
}
if (_create_event) {
_create_event->pre_process();
@@ -194,7 +190,8 @@ SetMetadata::pre_process()
_error = BAD_VALUE_TYPE;
}
} else if (key == uris.ingen_value) {
- SetPortValue* ev = new SetPortValue(_engine, _request, _time, port, value);
+ SetPortValue* ev = new SetPortValue(
+ _engine, _request_client, _request_id, _time, port, value);
ev->pre_process();
_set_events.push_back(ev);
} else if (key == uris.ingen_controlBinding) {
@@ -359,7 +356,7 @@ SetMetadata::post_process()
if (_create_event) {
_create_event->post_process();
} else {
- _request->respond_ok();
+ respond_ok();
if (_create)
_engine.broadcaster()->put(_subject, _properties, _context);
else
@@ -367,18 +364,18 @@ SetMetadata::post_process()
}
break;
case NOT_FOUND:
- _request->respond_error((boost::format(
+ respond_error((boost::format(
"Unable to find object `%1%'") % _subject).str());
break;
case INTERNAL:
- _request->respond_error("Internal error");
+ respond_error("Internal error");
break;
case BAD_OBJECT_TYPE:
- _request->respond_error((boost::format(
+ respond_error((boost::format(
"Bad type for object `%1%'") % _subject).str());
break;
case BAD_VALUE_TYPE:
- _request->respond_error((boost::format(
+ respond_error((boost::format(
"Bad metadata value type for subject `%1%' predicate `%2%'")
% _subject % _error_predicate).str());
break;
diff --git a/src/server/events/SetMetadata.hpp b/src/server/events/SetMetadata.hpp
index d8da99c0..512e35c0 100644
--- a/src/server/events/SetMetadata.hpp
+++ b/src/server/events/SetMetadata.hpp
@@ -69,15 +69,15 @@ class SetPortValue;
class SetMetadata : public Event
{
public:
- SetMetadata(
- Engine& engine,
- SharedPtr<Request> request,
- SampleCount timestamp,
- bool create,
- Resource::Graph context,
- const Raul::URI& subject,
- const Resource::Properties& properties,
- const Resource::Properties& remove = Resource::Properties());
+ SetMetadata(Engine& engine,
+ ClientInterface* client,
+ int32_t id,
+ SampleCount timestamp,
+ bool create,
+ Resource::Graph context,
+ const Raul::URI& subject,
+ const Resource::Properties& properties,
+ const Resource::Properties& remove = Resource::Properties());
~SetMetadata();
diff --git a/src/server/events/SetPortValue.cpp b/src/server/events/SetPortValue.cpp
index 1b0ec373..f96649b9 100644
--- a/src/server/events/SetPortValue.cpp
+++ b/src/server/events/SetPortValue.cpp
@@ -34,8 +34,6 @@
#include "ObjectBuffer.hpp"
#include "PortImpl.hpp"
#include "ProcessContext.hpp"
-#include "ProcessContext.hpp"
-#include "Request.hpp"
#include "SetPortValue.hpp"
using namespace std;
@@ -45,13 +43,14 @@ namespace Ingen {
namespace Server {
namespace Events {
-SetPortValue::SetPortValue(Engine& engine,
- SharedPtr<Request> request,
- bool queued,
- SampleCount timestamp,
- const Raul::Path& port_path,
- const Raul::Atom& value)
- : Event(engine, request, timestamp)
+SetPortValue::SetPortValue(Engine& engine,
+ ClientInterface* client,
+ int32_t id,
+ bool queued,
+ SampleCount timestamp,
+ const Raul::Path& port_path,
+ const Raul::Atom& value)
+ : Event(engine, client, id, timestamp)
, _queued(queued)
, _port_path(port_path)
, _value(value)
@@ -60,12 +59,13 @@ SetPortValue::SetPortValue(Engine& engine,
}
/** Internal */
-SetPortValue::SetPortValue(Engine& engine,
- SharedPtr<Request> request,
- SampleCount timestamp,
- PortImpl* port,
- const Raul::Atom& value)
- : Event(engine, request, timestamp)
+SetPortValue::SetPortValue(Engine& engine,
+ ClientInterface* client,
+ int32_t id,
+ SampleCount timestamp,
+ PortImpl* port,
+ const Raul::Atom& value)
+ : Event(engine, client, id, timestamp)
, _queued(false)
, _port_path(port->path())
, _value(value)
@@ -197,25 +197,25 @@ SetPortValue::post_process()
switch (_error) {
case NO_ERROR:
assert(_port != NULL);
- _request->respond_ok();
+ respond_ok();
_engine.broadcaster()->set_property(_port_path,
_engine.world()->uris()->ingen_value, _value);
break;
case TYPE_MISMATCH:
ss << "Illegal value type " << _value.type()
<< " for port " << _port_path << endl;
- _request->respond_error(ss.str());
+ respond_error(ss.str());
break;
case PORT_NOT_FOUND:
msg = "Unable to find port ";
msg.append(_port_path.str()).append(" to set value");
- _request->respond_error(msg);
+ respond_error(msg);
break;
case NO_SPACE:
ss << "Attempt to write " << _value.data_size() << " bytes to "
<< _port_path.str() << ", with capacity "
<< _port->buffer_size() << endl;
- _request->respond_error(ss.str());
+ respond_error(ss.str());
break;
}
}
diff --git a/src/server/events/SetPortValue.hpp b/src/server/events/SetPortValue.hpp
index ca69c789..2ceb37f6 100644
--- a/src/server/events/SetPortValue.hpp
+++ b/src/server/events/SetPortValue.hpp
@@ -43,18 +43,20 @@ namespace Events {
class SetPortValue : public Event
{
public:
- SetPortValue(Engine& engine,
- SharedPtr<Request> request,
- bool queued,
- SampleCount timestamp,
- const Raul::Path& port_path,
- const Raul::Atom& value);
+ SetPortValue(Engine& engine,
+ ClientInterface* client,
+ int32_t id,
+ bool queued,
+ SampleCount timestamp,
+ const Raul::Path& port_path,
+ const Raul::Atom& value);
- SetPortValue(Engine& engine,
- SharedPtr<Request> request,
- SampleCount timestamp,
- PortImpl* port,
- const Raul::Atom& value);
+ SetPortValue(Engine& engine,
+ ClientInterface* client,
+ int32_t id,
+ SampleCount timestamp,
+ PortImpl* port,
+ const Raul::Atom& value);
~SetPortValue();
diff --git a/src/server/events/UnregisterClient.cpp b/src/server/events/UnregisterClient.cpp
index e5ba1b4f..64c37fb8 100644
--- a/src/server/events/UnregisterClient.cpp
+++ b/src/server/events/UnregisterClient.cpp
@@ -16,7 +16,6 @@
*/
#include "ingen/ClientInterface.hpp"
-#include "Request.hpp"
#include "UnregisterClient.hpp"
#include "Engine.hpp"
#include "ClientBroadcaster.hpp"
@@ -27,8 +26,12 @@ namespace Ingen {
namespace Server {
namespace Events {
-UnregisterClient::UnregisterClient(Engine& engine, SharedPtr<Request> request, SampleCount timestamp, const URI& uri)
- : Event(engine, request, timestamp)
+UnregisterClient::UnregisterClient(Engine& engine,
+ ClientInterface* client,
+ int32_t id,
+ SampleCount timestamp,
+ const URI& uri)
+ : Event(engine, client, id, timestamp)
, _uri(uri)
{
}
@@ -37,9 +40,9 @@ void
UnregisterClient::post_process()
{
if (_engine.broadcaster()->unregister_client(_uri))
- _request->respond_ok();
+ respond_ok();
else
- _request->respond_error("Unable to unregister client");
+ respond_error("Unable to unregister client");
}
} // namespace Server
diff --git a/src/server/events/UnregisterClient.hpp b/src/server/events/UnregisterClient.hpp
index 86d24e1c..089b8d8e 100644
--- a/src/server/events/UnregisterClient.hpp
+++ b/src/server/events/UnregisterClient.hpp
@@ -32,10 +32,11 @@ namespace Events {
class UnregisterClient : public Event
{
public:
- UnregisterClient(Engine& engine,
- SharedPtr<Request> request,
- SampleCount timestamp,
- const Raul::URI& uri);
+ UnregisterClient(Engine& engine,
+ ClientInterface* client,
+ int32_t id,
+ SampleCount timestamp,
+ const Raul::URI& uri);
void post_process();
diff --git a/src/server/ingen_jack.cpp b/src/server/ingen_jack.cpp
index 73098e4c..23ece9ab 100644
--- a/src/server/ingen_jack.cpp
+++ b/src/server/ingen_jack.cpp
@@ -17,6 +17,8 @@
#include "ingen/shared/Module.hpp"
#include "ingen/shared/World.hpp"
+#include "raul/log.hpp"
+
#include "JackDriver.hpp"
#include "Engine.hpp"
@@ -25,6 +27,11 @@ using namespace Ingen;
struct IngenJackModule : public Ingen::Shared::Module {
void load(Ingen::Shared::World* world) {
+ if (((Server::Engine*)world->local_engine().get())->driver()) {
+ Raul::warn << "Engine already has a driver" << std::endl;
+ return;
+ }
+
Server::JackDriver* driver = new Server::JackDriver(
*(Server::Engine*)world->local_engine().get());
driver->attach(world->conf()->option("jack-server").get_string(),