server: Use std::shared_ptr
diff --git a/server/connection.hpp b/server/connection.hpp
index 791de02..cfac5f6 100644
--- a/server/connection.hpp
+++ b/server/connection.hpp
@@ -34,11 +34,12 @@
#include "request.hpp"
#include "request_handler.hpp"
#include "request_parser.hpp"
+
#include <boost/array.hpp>
#include <boost/asio.hpp>
-#include <boost/enable_shared_from_this.hpp>
#include <boost/noncopyable.hpp>
-#include <boost/shared_ptr.hpp>
+
+#include <memory>
namespace http {
namespace server {
@@ -46,7 +47,7 @@
class connection_manager;
/// Represents a single connection from a client.
-class connection : public boost::enable_shared_from_this<connection>, private boost::noncopyable
+class connection : public std::enable_shared_from_this<connection>, private boost::noncopyable
{
public:
/// Construct a connection with the given io_service.
@@ -96,7 +97,7 @@
reply reply_;
};
-typedef boost::shared_ptr<connection> connection_ptr;
+typedef std::shared_ptr<connection> connection_ptr;
} // namespace server
} // namespace http
diff --git a/server/request_handler.cpp b/server/request_handler.cpp
index d2b339e..1a959a1 100644
--- a/server/request_handler.cpp
+++ b/server/request_handler.cpp
@@ -28,24 +28,27 @@
//
#include "request_handler.hpp"
-#include "logging.h"
#include "mime_types.hpp"
#include "reply.hpp"
#include "request.hpp"
-#include <boost/lexical_cast.hpp>
-#include <QDataStream>
-#include <QFile>
-#include <QIODevice>
-#include <QString>
+#include "core/logging.hpp"
+
#include <fstream>
#include <sstream>
#include <string>
-INIT_LOGGER("HttpServer")
+#include <boost/lexical_cast.hpp>
+
+#include <QDataStream>
+#include <QFile>
+#include <QIODevice>
+#include <QString>
namespace http {
namespace server {
+INIT_LOGGER("HttpServer")
+
request_handler::request_handler(const std::string& doc_root)
: doc_root_(doc_root.c_str())
{
diff --git a/server/server.cpp b/server/server.cpp
index 9ffa4eb..fd91b04 100644
--- a/server/server.cpp
+++ b/server/server.cpp
@@ -28,14 +28,17 @@
//
#include "server.hpp"
-#include "logging.h"
-#include <boost/bind.hpp>
+#include "core/logging.hpp"
+
#include <signal.h>
-INIT_LOGGER("HttpServer");
namespace http {
namespace server {
+using namespace ndn::chronoshare;
+
+INIT_LOGGER("HttpServer");
+
server::server(const std::string& address, const std::string& port, const std::string& doc_root)
: io_service_()
,
@@ -53,7 +56,7 @@
//#if defined(SIGQUIT)
// signals_.add(SIGQUIT);
//#endif // defined(SIGQUIT)
- // signals_.async_wait(boost::bind(&server::handle_stop, this));
+ // signals_.async_wait(std::bind(&server::handle_stop, this));
// Open the acceptor with the option to reuse the address (i.e. SO_REUSEADDR).
boost::asio::ip::tcp::resolver resolver(io_service_);
@@ -89,7 +92,7 @@
{
new_connection_.reset(new connection(io_service_, connection_manager_, request_handler_));
acceptor_.async_accept(new_connection_->socket(),
- boost::bind(&server::handle_accept, this, boost::asio::placeholders::error));
+ std::bind(&server::handle_accept, this, std::placeholders::_1));
}
void