summaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2010-01-07 05:30:58 +0000
committerDavid Robillard <d@drobilla.net>2010-01-07 05:30:58 +0000
commit2cd6cbac63b4eafde20698e918151b27908fd335 (patch)
tree82790b280d3a9d1f1c82bf11c8111c59a5b88032 /src/client
parent1de7af2e453735869122ca61f65be157d7b799bd (diff)
downloadingen-2cd6cbac63b4eafde20698e918151b27908fd335.tar.gz
ingen-2cd6cbac63b4eafde20698e918151b27908fd335.tar.bz2
ingen-2cd6cbac63b4eafde20698e918151b27908fd335.zip
Better log output.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2361 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/client')
-rw-r--r--src/client/HTTPClientReceiver.cpp18
-rw-r--r--src/client/HTTPClientReceiver.hpp1
-rw-r--r--src/client/HTTPEngineSender.cpp10
-rw-r--r--src/client/OSCClientReceiver.cpp9
4 files changed, 20 insertions, 18 deletions
diff --git a/src/client/HTTPClientReceiver.cpp b/src/client/HTTPClientReceiver.cpp
index 9545bbe6..308b631b 100644
--- a/src/client/HTTPClientReceiver.cpp
+++ b/src/client/HTTPClientReceiver.cpp
@@ -61,16 +61,11 @@ HTTPClientReceiver::~HTTPClientReceiver()
}
-HTTPClientReceiver::Listener::~Listener()
-{
- close(_sock);
-}
-
HTTPClientReceiver::Listener::Listener(HTTPClientReceiver* receiver, const std::string uri)
: _uri(uri)
, _receiver(receiver)
{
- string port_str = uri.substr(uri.find_last_of(":")+1);
+ const string port_str = uri.substr(uri.find_last_of(":")+1);
int port = atoi(port_str.c_str());
LOG(info) << "Client HTTP listen: " << uri << " (port " << port << ")" << endl;
@@ -105,12 +100,20 @@ HTTPClientReceiver::Listener::Listener(HTTPClientReceiver* receiver, const std::
}
+HTTPClientReceiver::Listener::~Listener()
+{
+ close(_sock);
+}
+
void
HTTPClientReceiver::send(SoupMessage* msg)
{
- if (!client_session)
+ if (!client_session) {
+ LOG(debug) << "Starting session" << endl;
client_session = soup_session_sync_new();
+ }
+ assert(SOUP_IS_MESSAGE(msg));
soup_session_queue_message(client_session, msg, message_callback, client_receiver);
}
@@ -231,6 +234,7 @@ HTTPClientReceiver::start(bool dump)
_world->load("ingen_serialisation");
SoupMessage* msg = soup_message_new("GET", (_url + "/stream").c_str());
+ assert(SOUP_IS_MESSAGE(msg));
soup_session_queue_message(client_session, msg, message_callback, this);
}
diff --git a/src/client/HTTPClientReceiver.hpp b/src/client/HTTPClientReceiver.hpp
index 4916ddea..58896672 100644
--- a/src/client/HTTPClientReceiver.hpp
+++ b/src/client/HTTPClientReceiver.hpp
@@ -73,6 +73,7 @@ private:
Shared::World* _world;
const std::string _url;
+ bool _quit_flag;
};
diff --git a/src/client/HTTPEngineSender.cpp b/src/client/HTTPEngineSender.cpp
index 105d54a8..abf5180e 100644
--- a/src/client/HTTPEngineSender.cpp
+++ b/src/client/HTTPEngineSender.cpp
@@ -23,6 +23,8 @@
#include "HTTPEngineSender.hpp"
#include "HTTPClientReceiver.hpp"
+#define LOG(s) s << "[HTTPEngineSender] "
+
using namespace std;
using namespace Raul;
@@ -49,6 +51,7 @@ HTTPEngineSender::~HTTPEngineSender()
void
HTTPEngineSender::attach(int32_t ping_id, bool block)
{
+ LOG(debug) << "Attaching to " << _engine_url << endl;
SoupMessage* msg = soup_message_new ("GET", _engine_url.c_str());
HTTPClientReceiver::send(msg);
}
@@ -212,14 +215,15 @@ HTTPEngineSender::set_property(const URI& subject,
void
HTTPEngineSender::ping()
{
- SoupMessage* msg = soup_message_new("GET", "");
- HTTPClientReceiver::send(msg);
+ LOG(debug) << "Ping " << _engine_url << endl;
+ get(_engine_url);
}
void
HTTPEngineSender::get(const URI& uri)
{
+ LOG(debug) << "Get " << _engine_url << endl;
SoupMessage* msg = soup_message_new("GET", uri.c_str());
HTTPClientReceiver::send(msg);
}
@@ -228,7 +232,7 @@ HTTPEngineSender::get(const URI& uri)
void
HTTPEngineSender::request_property(const URI& object_path, const URI& key)
{
- warn << "TODO: HTTP request property" << endl;
+ LOG(warn) << "TODO: request property" << endl;
}
diff --git a/src/client/OSCClientReceiver.cpp b/src/client/OSCClientReceiver.cpp
index 9a1808a2..09687f2c 100644
--- a/src/client/OSCClientReceiver.cpp
+++ b/src/client/OSCClientReceiver.cpp
@@ -105,7 +105,7 @@ OSCClientReceiver::stop()
int
OSCClientReceiver::generic_cb(const char* path, const char* types, lo_arg** argv, int argc, void* data, void* user_data)
{
- printf("[OSCMsg] %s (%s)\t", path, types);
+ printf("[OSCClientReceiver] %s (%s)\t", path, types);
for (int i=0; i < argc; ++i) {
lo_arg_pp(lo_type(types[i]), argv[i]);
@@ -113,13 +113,6 @@ OSCClientReceiver::generic_cb(const char* path, const char* types, lo_arg** argv
}
printf("\n");
- /*for (int i=0; i < argc; ++i) {
- printf(" '%c' ", types[i]);
- lo_arg_pp(lo_type(types[i]), argv[i]);
- printf("\n");
- }
- printf("\n");*/
-
return 1; // not handled
}