summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-04-19 19:37:12 +0000
committerDavid Robillard <d@drobilla.net>2011-04-19 19:37:12 +0000
commit375e57574e08d746c6c12255836face2066ebf4c (patch)
treea2681f6302b835c81ea74ee849227d7b9c66e3b4 /src
parent338ebbcd23747d3274f100b1c78caeb1d157dde0 (diff)
downloadingen-375e57574e08d746c6c12255836face2066ebf4c.tar.gz
ingen-375e57574e08d746c6c12255836face2066ebf4c.tar.bz2
ingen-375e57574e08d746c6c12255836face2066ebf4c.zip
Merge "transfer" stuff with "bundle" stuff (functionally equivalent anyway).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3166 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/bindings/Client.hpp2
-rw-r--r--src/client/HTTPEngineSender.hpp7
-rw-r--r--src/client/OSCEngineSender.hpp2
-rw-r--r--src/client/SigClientInterface.hpp3
-rw-r--r--src/client/ThreadedSigClientInterface.hpp3
-rw-r--r--src/engine/ClientBroadcaster.cpp4
-rw-r--r--src/engine/ClientBroadcaster.hpp2
-rw-r--r--src/engine/HTTPClientSender.hpp6
-rw-r--r--src/engine/OSCClientSender.hpp6
-rw-r--r--src/engine/ObjectSender.cpp8
-rw-r--r--src/shared/HTTPSender.hpp5
-rw-r--r--src/shared/OSCSender.cpp48
-rw-r--r--src/shared/OSCSender.hpp10
13 files changed, 27 insertions, 79 deletions
diff --git a/src/bindings/Client.hpp b/src/bindings/Client.hpp
index bcf7b50a..6eaa3dc8 100644
--- a/src/bindings/Client.hpp
+++ b/src/bindings/Client.hpp
@@ -13,8 +13,6 @@ public:
void bundle_begin() {}
void bundle_end() {}
- void transfer_begin() {}
- void transfer_end() {}
void response_ok(int32_t id) {}
void response_error(int32_t id, const std::string& msg) {}
void error(const std::string& msg) {}
diff --git a/src/client/HTTPEngineSender.hpp b/src/client/HTTPEngineSender.hpp
index 19742498..3a0b1a40 100644
--- a/src/client/HTTPEngineSender.hpp
+++ b/src/client/HTTPEngineSender.hpp
@@ -65,11 +65,8 @@ public:
void enable() { _enabled = true; }
void disable() { _enabled = false; }
- void bundle_begin() { transfer_begin(); }
- void bundle_end() { transfer_end(); }
-
- void transfer_begin() {}
- void transfer_end() {}
+ void bundle_begin() {}
+ void bundle_end() {}
// Client registration
void register_client(ClientInterface* client);
diff --git a/src/client/OSCEngineSender.hpp b/src/client/OSCEngineSender.hpp
index bc05a393..e5a2fc9f 100644
--- a/src/client/OSCEngineSender.hpp
+++ b/src/client/OSCEngineSender.hpp
@@ -60,8 +60,6 @@ public:
void bundle_begin() { OSCSender::bundle_begin(); }
void bundle_end() { OSCSender::bundle_end(); }
- void transfer_begin() { OSCSender::transfer_begin(); }
- void transfer_end() { OSCSender::transfer_end(); }
// Client registration
void register_client(ClientInterface* client);
diff --git a/src/client/SigClientInterface.hpp b/src/client/SigClientInterface.hpp
index 57a972f6..26a64f85 100644
--- a/src/client/SigClientInterface.hpp
+++ b/src/client/SigClientInterface.hpp
@@ -78,9 +78,6 @@ protected:
void bundle_end()
{ EMIT(bundle_end); }
- void transfer_begin() {}
- void transfer_end() {}
-
void response_ok(int32_t id)
{ EMIT(response_ok, id); }
diff --git a/src/client/ThreadedSigClientInterface.hpp b/src/client/ThreadedSigClientInterface.hpp
index e7dc336d..84f9c009 100644
--- a/src/client/ThreadedSigClientInterface.hpp
+++ b/src/client/ThreadedSigClientInterface.hpp
@@ -72,9 +72,6 @@ public:
void bundle_end()
{ push_sig(bundle_end_slot); }
- void transfer_begin() {}
- void transfer_end() {}
-
void response_ok(int32_t id)
{ push_sig(sigc::bind(response_ok_slot, id)); }
diff --git a/src/engine/ClientBroadcaster.cpp b/src/engine/ClientBroadcaster.cpp
index 85c23f3f..46c50ea6 100644
--- a/src/engine/ClientBroadcaster.cpp
+++ b/src/engine/ClientBroadcaster.cpp
@@ -90,14 +90,14 @@ ClientBroadcaster::send_plugins(const NodeFactory::Plugins& plugins)
void
ClientBroadcaster::send_plugins_to(ClientInterface* client, const NodeFactory::Plugins& plugins)
{
- client->transfer_begin();
+ client->bundle_begin();
for (NodeFactory::Plugins::const_iterator i = plugins.begin(); i != plugins.end(); ++i) {
const PluginImpl* const plugin = i->second;
client->put(plugin->uri(), plugin->properties());
}
- client->transfer_end();
+ client->bundle_end();
}
/** Send an object to all clients.
diff --git a/src/engine/ClientBroadcaster.hpp b/src/engine/ClientBroadcaster.hpp
index 1c77c46b..989ed41b 100644
--- a/src/engine/ClientBroadcaster.hpp
+++ b/src/engine/ClientBroadcaster.hpp
@@ -111,8 +111,6 @@ public:
void response_ok(int32_t id) {} ///< N/A
void response_error(int32_t id, const std::string& msg) {} ///< N/A
- void transfer_begin() { BROADCAST(transfer_begin); }
- void transfer_end() { BROADCAST(transfer_end); }
void error(const std::string& msg) { BROADCAST(error, msg); }
void activity(const Raul::Path& path) { BROADCAST(activity, path); }
diff --git a/src/engine/HTTPClientSender.hpp b/src/engine/HTTPClientSender.hpp
index 274d54cd..aa7baf88 100644
--- a/src/engine/HTTPClientSender.hpp
+++ b/src/engine/HTTPClientSender.hpp
@@ -54,10 +54,8 @@ public:
void enable() { _enabled = true; }
void disable() { _enabled = false; }
- void bundle_begin() { HTTPSender::bundle_begin(); }
- void bundle_end() { HTTPSender::bundle_end(); }
- void transfer_begin() { HTTPSender::transfer_begin(); }
- void transfer_end() { HTTPSender::transfer_end(); }
+ void bundle_begin() { HTTPSender::bundle_begin(); }
+ void bundle_end() { HTTPSender::bundle_end(); }
Raul::URI uri() const { return "http://example.org/"; }
diff --git a/src/engine/OSCClientSender.hpp b/src/engine/OSCClientSender.hpp
index 147c0779..a30deb15 100644
--- a/src/engine/OSCClientSender.hpp
+++ b/src/engine/OSCClientSender.hpp
@@ -55,10 +55,8 @@ public:
void enable() { _enabled = true; }
void disable() { _enabled = false; }
- void bundle_begin() { OSCSender::bundle_begin(); }
- void bundle_end() { OSCSender::bundle_end(); }
- void transfer_begin() { OSCSender::transfer_begin(); }
- void transfer_end() { OSCSender::transfer_end(); }
+ void bundle_begin() { OSCSender::bundle_begin(); }
+ void bundle_end() { OSCSender::bundle_end(); }
Raul::URI uri() const { return _url; }
diff --git a/src/engine/ObjectSender.cpp b/src/engine/ObjectSender.cpp
index ae2383d6..77b6c5e3 100644
--- a/src/engine/ObjectSender.cpp
+++ b/src/engine/ObjectSender.cpp
@@ -61,7 +61,7 @@ void
ObjectSender::send_patch(ClientInterface* client, const PatchImpl* patch, bool recursive, bool bundle)
{
if (bundle)
- client->transfer_begin();
+ client->bundle_begin();
client->put(patch->path(),
patch->properties(Resource::INTERNAL),
@@ -92,7 +92,7 @@ ObjectSender::send_patch(ClientInterface* client, const PatchImpl* patch, bool r
}
if (bundle)
- client->transfer_end();
+ client->bundle_end();
}
/** Sends a node or a patch */
@@ -112,7 +112,7 @@ ObjectSender::send_node(ClientInterface* client, const NodeImpl* node, bool recu
}
if (bundle)
- client->transfer_begin();
+ client->bundle_begin();
client->put(node->path(), node->properties());
@@ -123,7 +123,7 @@ ObjectSender::send_node(ClientInterface* client, const NodeImpl* node, bool recu
}
if (bundle)
- client->transfer_end();
+ client->bundle_end();
}
void
diff --git a/src/shared/HTTPSender.hpp b/src/shared/HTTPSender.hpp
index 3974c2ab..5c26a386 100644
--- a/src/shared/HTTPSender.hpp
+++ b/src/shared/HTTPSender.hpp
@@ -31,14 +31,9 @@ public:
HTTPSender();
virtual ~HTTPSender();
- // Message bundling
void bundle_begin();
void bundle_end();
- // Transfers (loose bundling)
- void transfer_begin() { bundle_begin(); }
- void transfer_end() { bundle_end(); }
-
int listen_port() const { return _listen_port; }
protected:
diff --git a/src/shared/OSCSender.cpp b/src/shared/OSCSender.cpp
index f5940efa..58b9ddae 100644
--- a/src/shared/OSCSender.cpp
+++ b/src/shared/OSCSender.cpp
@@ -29,8 +29,7 @@ namespace Ingen {
namespace Shared {
OSCSender::OSCSender()
- : _send_state(Immediate)
- , _transfer(NULL)
+ : _bundle(NULL)
, _address(NULL)
, _enabled(true)
{
@@ -39,37 +38,19 @@ OSCSender::OSCSender()
void
OSCSender::bundle_begin()
{
- assert(!_transfer);
+ assert(!_bundle);
lo_timetag t;
lo_timetag_now(&t);
- _transfer = lo_bundle_new(t);
- _send_state = SendingBundle;
+ _bundle = lo_bundle_new(t);
}
void
OSCSender::bundle_end()
{
- transfer_end();
-}
-
-void
-OSCSender::transfer_begin()
-{
- assert(!_transfer);
- lo_timetag t;
- lo_timetag_now(&t);
- _transfer = lo_bundle_new(t);
- _send_state = SendingTransfer;
-}
-
-void
-OSCSender::transfer_end()
-{
- assert(_transfer);
- lo_send_bundle(_address, _transfer);
- lo_bundle_free_messages(_transfer);
- _transfer = NULL;
- _send_state = Immediate;
+ assert(_bundle);
+ lo_send_bundle(_address, _bundle);
+ lo_bundle_free_messages(_bundle);
+ _bundle = NULL;
}
int
@@ -110,17 +91,16 @@ OSCSender::send_message(const char* path, lo_message msg)
return;
}
- if (_transfer) {
- if (lo_bundle_length(_transfer) + lo_message_length(msg, path) > MAX_BUNDLE_SIZE) {
- if (_send_state == SendingBundle)
- warn << "Maximum bundle size reached, bundle split" << endl;
- lo_send_bundle(_address, _transfer);
- lo_bundle_free_messages(_transfer);
+ if (_bundle) {
+ if (lo_bundle_length(_bundle) + lo_message_length(msg, path) > MAX_BUNDLE_SIZE) {
+ warn << "Maximum bundle size reached, bundle split" << endl;
+ lo_send_bundle(_address, _bundle);
+ lo_bundle_free_messages(_bundle);
lo_timetag t;
lo_timetag_now(&t);
- _transfer = lo_bundle_new(t);
+ _bundle = lo_bundle_new(t);
}
- lo_bundle_add_message(_transfer, path, msg);
+ lo_bundle_add_message(_bundle, path, msg);
} else {
lo_send_message(_address, path, msg);
diff --git a/src/shared/OSCSender.hpp b/src/shared/OSCSender.hpp
index 8571edd0..1085f2ae 100644
--- a/src/shared/OSCSender.hpp
+++ b/src/shared/OSCSender.hpp
@@ -31,22 +31,14 @@ public:
lo_address address() const { return _address; }
- // Message bundling
void bundle_begin();
void bundle_end();
- // Transfers (loose bundling)
- void transfer_begin();
- void transfer_end();
-
protected:
int send(const char *path, const char *types, ...);
void send_message(const char* path, lo_message m);
- enum SendState { Immediate, SendingBundle, SendingTransfer };
-
- SendState _send_state;
- lo_bundle _transfer;
+ lo_bundle _bundle;
lo_address _address;
bool _enabled;
};