summaryrefslogtreecommitdiffstats
path: root/src/shared
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/shared
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/shared')
-rw-r--r--src/shared/HTTPSender.hpp5
-rw-r--r--src/shared/OSCSender.cpp48
-rw-r--r--src/shared/OSCSender.hpp10
3 files changed, 15 insertions, 48 deletions
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;
};