From Stephan Huber, updated to debug output to RestHttpDevice and tweaks to ImageIO and QTKit plugins

This commit is contained in:
Robert Osfield
2012-11-05 12:03:50 +00:00
parent 18d66619b0
commit d7ce523529
6 changed files with 24 additions and 6 deletions

View File

@@ -101,6 +101,7 @@ void OSXQTKitVideo::initializeQTKit()
EnterMovies();
QTMovie* movie = [QTMovie movie];
// release missing by intent, gets released by the block!
movie = NULL;
});
}
else

View File

@@ -22,10 +22,10 @@ public:
StandardRequestHandler() : RestHttpDevice::RequestHandler("") {}
virtual bool operator()(const std::string& request_path, const std::string& full_request_path, const Arguments& arguments, http::server::reply& reply)
{
std::cout << "unhandled request: " << full_request_path << std::endl;
OSG_NOTICE << "RestHttpDevice :: unhandled request: " << full_request_path << std::endl;
for(Arguments::const_iterator i = arguments.begin(); i != arguments.end(); ++i)
{
std::cout << " " << i->first << ": " << i->second << std::endl;
OSG_NOTICE << "RestHttpDevice :: " << i->first << ": " << i->second << std::endl;
}
return false;
@@ -359,14 +359,15 @@ bool RestHttpDevice::handleRequest(const std::string& in_request_path, http::se
void RestHttpDevice::describeTo(std::ostream& out) const
{
out << "Server: " << _serverAddress << std::endl;
out << "Port: " << _serverPort << std::endl;
out << "Document-Root: " << _documentRoot << std::endl;
out << "RestHttpDevice :: Server: " << _serverAddress << std::endl;
out << "RestHttpDevice :: Port: " << _serverPort << std::endl;
out << "RestHttpDevice :: Document-Root: " << _documentRoot << std::endl;
out << std::endl;
for(RequestHandlerMap::const_iterator i = _map.begin(); i != _map.end(); ++i)
{
const RequestHandler* handler(i->second.get());
out << "RestHttpDevice :: ";
handler->describeTo(out);
out << std::endl;
}

View File

@@ -12,6 +12,7 @@
#include <vector>
#include <boost/bind.hpp>
#include "request_handler.hpp"
#include <osg/Notify>
namespace http {
namespace server {
@@ -21,8 +22,13 @@ connection::connection(asio::io_service& io_service,
: socket_(io_service),
request_handler_(handler)
{
OSG_INFO << "RestHttpDevice :: connection::connection" << std::endl;
}
connection::~connection()
{
OSG_INFO << "RestHttpDevice :: connection::~connection" << std::endl;
}
asio::ip::tcp::socket& connection::socket()
{
return socket_;
@@ -30,6 +36,8 @@ asio::ip::tcp::socket& connection::socket()
void connection::start()
{
OSG_INFO << "RestHttpDevice :: connection::start" << std::endl;
socket_.async_read_some(asio::buffer(buffer_),
boost::bind(&connection::handle_read, shared_from_this(),
asio::placeholders::error,

View File

@@ -39,7 +39,7 @@ public:
/// Start the first asynchronous operation for the connection.
void start();
~connection();
private:
/// Handle completion of a read operation.
void handle_read(const asio::error_code& e,

View File

@@ -37,11 +37,13 @@ server::server(const std::string& address, const std::string& port,
void server::run()
{
OSG_INFO << "RestHttpDevice :: server::run" << std::endl;
io_service_pool_.run();
}
void server::stop()
{
OSG_INFO << "RestHttpDevice :: server::stop" << std::endl;
io_service_pool_.stop();
}
@@ -49,6 +51,7 @@ void server::handle_accept(const asio::error_code& e)
{
if (!e)
{
OSG_INFO << "RestHttpDevice :: server::handle_accept" << std::endl;
new_connection_->start();
new_connection_.reset(new connection(
io_service_pool_.get_io_service(), request_handler_));
@@ -56,6 +59,10 @@ void server::handle_accept(const asio::error_code& e)
boost::bind(&server::handle_accept, this,
asio::placeholders::error));
}
else
{
OSG_WARN << "RestHttpDevice :: server::handle_accept error: " << e.message() << std::endl;
}
}
} // namespace server

View File

@@ -336,6 +336,7 @@ osg::Image* CreateOSGImageFromCGImage(CGImageRef image_ref)
//
case 16:
case 32:
case 48:
case 64:
{