From 0fd3c583e032a3cd5af877902d4561a45179a232 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 16 Nov 2008 05:34:01 +0000 Subject: Follow new object creation via HTTP (serialising/parsing RDF to communicate between client and engine). git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1722 a436a847-0d15-0410-975c-d299462d15a1 --- src/shared/ClashAvoider.cpp | 9 +++++++++ src/shared/ClashAvoider.hpp | 2 ++ src/shared/HTTPSender.cpp | 15 +++++++-------- 3 files changed, 18 insertions(+), 8 deletions(-) (limited to 'src/shared') diff --git a/src/shared/ClashAvoider.cpp b/src/shared/ClashAvoider.cpp index ca322b74..aa7dd774 100644 --- a/src/shared/ClashAvoider.cpp +++ b/src/shared/ClashAvoider.cpp @@ -126,6 +126,15 @@ ClashAvoider::exists(const Raul::Path& path) const } +void +ClashAvoider::new_object(const GraphObject* object) +{ + // FIXME: + ((GraphObject*)object)->set_path(map_path(object->path())); + _target.new_object(object); +} + + void ClashAvoider::new_patch(const std::string& path, uint32_t poly) diff --git a/src/shared/ClashAvoider.hpp b/src/shared/ClashAvoider.hpp index ac2d62bb..ead6d96c 100644 --- a/src/shared/ClashAvoider.hpp +++ b/src/shared/ClashAvoider.hpp @@ -49,6 +49,8 @@ public: // Object commands + void new_object(const GraphObject* object); + void new_patch(const std::string& path, uint32_t poly); diff --git a/src/shared/HTTPSender.cpp b/src/shared/HTTPSender.cpp index 7f760786..1b38f97f 100644 --- a/src/shared/HTTPSender.cpp +++ b/src/shared/HTTPSender.cpp @@ -109,8 +109,9 @@ HTTPSender::_run() _signal.wait(_mutex); write(_client_sock, _transfer.c_str(), _transfer.length()); - write(_client_sock, "\n\n", 2); + write(_client_sock, "\n\n\n", 2); + _signal.broadcast(); _mutex.unlock(); } @@ -125,16 +126,15 @@ HTTPSender::bundle_begin() _mutex.lock(); _send_state = SendingBundle; _transfer = ""; - _mutex.unlock(); } void HTTPSender::bundle_end() { - _mutex.lock(); assert(_send_state == SendingBundle); _signal.broadcast(); + _signal.wait(_mutex); _send_state = Immediate; _mutex.unlock(); } @@ -143,16 +143,15 @@ HTTPSender::bundle_end() void HTTPSender::send_chunk(const std::string& buf) { - _mutex.lock(); - if (_send_state == Immediate) { - _transfer = ""; + _mutex.lock(); + _transfer = buf; _signal.broadcast(); + _signal.wait(_mutex); + _mutex.unlock(); } else { _transfer.append(buf); } - - _mutex.unlock(); } -- cgit v1.2.1