summaryrefslogtreecommitdiffstats
path: root/src
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
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')
-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
-rw-r--r--src/engine/HTTPEngineReceiver.cpp5
-rw-r--r--src/engine/OSCEngineReceiver.cpp6
-rw-r--r--src/shared/HTTPSender.cpp2
7 files changed, 26 insertions, 25 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
}
diff --git a/src/engine/HTTPEngineReceiver.cpp b/src/engine/HTTPEngineReceiver.cpp
index 16369bde..a621132a 100644
--- a/src/engine/HTTPEngineReceiver.cpp
+++ b/src/engine/HTTPEngineReceiver.cpp
@@ -54,12 +54,11 @@ HTTPEngineReceiver::HTTPEngineReceiver(Engine& engine, uint16_t port)
soup_server_add_handler(_server, NULL, message_callback, this, NULL);
LOG(info) << "Started HTTP server on port " << soup_server_get_port(_server) << endl;
- Thread::set_name("HTTP Receiver");
if (!engine.world()->parser || !engine.world()->serialiser)
engine.world()->load("ingen_serialisation");
- Thread::set_name("HTTP Receiver");
+ Thread::set_name("HTTPEngineReceiver");
}
@@ -81,7 +80,7 @@ void
HTTPEngineReceiver::activate_source()
{
EventSource::activate_source();
- _receive_thread->set_name("HTTP Receiver");
+ _receive_thread->set_name("HTTPEngineReceiver Listener");
_receive_thread->start();
}
diff --git a/src/engine/OSCEngineReceiver.cpp b/src/engine/OSCEngineReceiver.cpp
index 95823c1d..8d1a49dc 100644
--- a/src/engine/OSCEngineReceiver.cpp
+++ b/src/engine/OSCEngineReceiver.cpp
@@ -115,7 +115,7 @@ OSCEngineReceiver::OSCEngineReceiver(Engine& engine, size_t queue_size, uint16_t
lo_server_add_method(_server, NULL, NULL, unknown_cb, NULL);
- Thread::set_name("OSC Receiver");
+ Thread::set_name("OSCEngineReceiver");
}
@@ -140,7 +140,7 @@ void
OSCEngineReceiver::activate_source()
{
EventSource::activate_source();
- _receive_thread->set_name("OSC Receiver");
+ _receive_thread->set_name("OSCEngineReceiver Listener");
_receive_thread->start();
_receive_thread->set_scheduling(SCHED_FIFO, 5); // Jack default appears to be 10
}
@@ -713,7 +713,7 @@ OSCEngineReceiver::_request_all_objects_cb(const char* path, const char* types,
int
OSCEngineReceiver::generic_cb(const char* path, const char* types, lo_arg** argv, int argc, lo_message msg, void* user_data)
{
- printf("[OSCMsg] %s (%s)\t", path, types);
+ printf("[OSCEngineReceiver] %s (%s)\t", path, types);
for (int i=0; i < argc; ++i) {
lo_arg_pp(lo_type(types[i]), argv[i]);
diff --git a/src/shared/HTTPSender.cpp b/src/shared/HTTPSender.cpp
index cbfa0107..bc50f276 100644
--- a/src/shared/HTTPSender.cpp
+++ b/src/shared/HTTPSender.cpp
@@ -40,7 +40,7 @@ HTTPSender::HTTPSender()
, _client_sock(-1)
, _send_state(Immediate)
{
- Thread::set_name("HTTP Sender");
+ Thread::set_name("HTTPSender");
struct sockaddr_in addr;