summaryrefslogtreecommitdiffstats
path: root/src/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/ClashAvoider.cpp9
-rw-r--r--src/shared/ClashAvoider.hpp2
-rw-r--r--src/shared/HTTPSender.cpp15
3 files changed, 18 insertions, 8 deletions
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
@@ -127,6 +127,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();
}