From 65f4c6021c03eb14084a1e6446185274fec751fe Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 20 May 2011 03:48:01 +0000 Subject: Fix multiple put replies on port creation. Include value in initial put response for control ports. git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3296 a436a847-0d15-0410-975c-d299462d15a1 --- src/server/ObjectSender.cpp | 14 +++++++++----- src/server/PortImpl.cpp | 2 ++ src/server/events/SetMetadata.cpp | 13 +++++++------ 3 files changed, 18 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/server/ObjectSender.cpp b/src/server/ObjectSender.cpp index 22aff285..a166a885 100644 --- a/src/server/ObjectSender.cpp +++ b/src/server/ObjectSender.cpp @@ -134,11 +134,15 @@ ObjectSender::send_port(ClientInterface* client, const PortImpl* port, bool bund if (bundle) client->bundle_begin(); - client->put(port->path(), port->properties()); - - // Send control value - if (port->is_a(PortType::CONTROL)) - client->set_property(port->path(), port->bufs().uris().ingen_value, port->value()); + if (port->is_a(PortType::CONTROL)) { + Resource::Properties props = port->properties(); + props.erase(port->bufs().uris().ingen_value); + props.insert(make_pair(port->bufs().uris().ingen_value, + port->value())); + client->put(port->path(), props); + } else { + client->put(port->path(), port->properties()); + } if (bundle) client->bundle_end(); diff --git a/src/server/PortImpl.cpp b/src/server/PortImpl.cpp index a448916e..6ccc4547 100644 --- a/src/server/PortImpl.cpp +++ b/src/server/PortImpl.cpp @@ -74,6 +74,8 @@ PortImpl::PortImpl(BufferFactory& bufs, if (type == PortType::EVENTS) _broadcast = true; // send activity blips + else if (type == PortType::CONTROL) + _value = Raul::Atom(0.0f); } PortImpl::~PortImpl() diff --git a/src/server/events/SetMetadata.cpp b/src/server/events/SetMetadata.cpp index 1812ad91..d9d44cc0 100644 --- a/src/server/events/SetMetadata.cpp +++ b/src/server/events/SetMetadata.cpp @@ -346,14 +346,15 @@ SetMetadata::post_process() switch (_error) { case NO_ERROR: - if (_create_event) + if (_create_event) { _create_event->post_process(); - else + } else { _request->respond_ok(); - if (_create) - _engine.broadcaster()->put(_subject, _properties, _context); - else - _engine.broadcaster()->delta(_subject, _remove, _properties); + if (_create) + _engine.broadcaster()->put(_subject, _properties, _context); + else + _engine.broadcaster()->delta(_subject, _remove, _properties); + } break; case NOT_FOUND: _request->respond_error((boost::format( -- cgit v1.2.1