Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

universal_connection #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions service/server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@
#include <signal.h>
#include <utility>
#include <memory>
#include "connection.hpp"
#include "transient_connection.hpp"
#include "connection_manager.hpp"
#include "request_handler.hpp"

namespace http {
namespace server {

/// The top-level class of the HTTP server.
template<typename request_handler_type, template<class> class connection_impl = connection>
template<typename request_handler_type, template<class> class connection_impl = transient_connection>
class server
{
public:
Expand Down
16 changes: 8 additions & 8 deletions service/connection.hpp → service/transient_connection.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@ template<class> class connection_manager;

/// Represents a single connection from a client.
template <typename request_handler_type>
class connection
: public std::enable_shared_from_this<connection<request_handler_type> >
class transient_connection
: public std::enable_shared_from_this<transient_connection<request_handler_type> >
{
typedef connection<request_handler_type> self_type;
typedef std::shared_ptr<self_type> self_type_ptr;
typedef connection_manager<self_type_ptr> connection_manager_type;
using self_type = transient_connection<request_handler_type> ;
using self_type_ptr = std::shared_ptr<self_type> ;
using connection_manager_type = connection_manager<self_type_ptr> ;
public:
connection(const connection&) = delete;
connection& operator=(const connection&) = delete;
transient_connection(const transient_connection&) = delete;
transient_connection& operator=(const transient_connection&) = delete;

/// Construct a connection with the given socket.
explicit connection(boost::asio::ip::tcp::socket socket,
explicit transient_connection(boost::asio::ip::tcp::socket socket,
connection_manager_type& manager, request_handler_type& handler)
: socket_(std::move(socket)),
connection_manager_(manager),
Expand Down