moves adaptor functions into endpoint_impl

This commit is contained in:
Peter Thorson
2013-02-01 07:19:11 -06:00
parent 30412282ee
commit 30134f8545
2 changed files with 70 additions and 47 deletions

View File

@@ -254,63 +254,22 @@ public:
/**
* Is thread safe if transport is
*/
void interrupt(connection_hdl hdl, lib::error_code & ec) {
connection_ptr con = get_con_from_hdl(hdl);
if (!con) {
ec = error::make_error_code(error::bad_connection);
return;
}
m_alog.write(log::alevel::devel,
"Interrupting connection"+con.get());
ec = con->interrupt();
}
void interrupt(connection_hdl hdl, lib::error_code & ec);
/**
* Is thread safe if transport is
*/
void interrupt(connection_hdl hdl) {
lib::error_code ec;
interrupt(hdl,ec);
if (ec) { throw ec; }
}
void interrupt(connection_hdl hdl);
void send(connection_hdl hdl, const std::string& payload,
frame::opcode::value op, lib::error_code & ec)
{
connection_ptr con = get_con_from_hdl(hdl);
if (!con) {
ec = error::make_error_code(error::bad_connection);
return;
}
ec = con->send(payload,op);
}
frame::opcode::value op, lib::error_code & ec);
void send(connection_hdl hdl, const std::string& payload,
frame::opcode::value op)
{
lib::error_code ec;
send(hdl,payload,op,ec);
if (ec) { throw ec; }
}
frame::opcode::value op);
void send(connection_hdl hdl, message_ptr msg, lib::error_code & ec) {
connection_ptr con = get_con_from_hdl(hdl);
if (!con) {
ec = error::make_error_code(error::bad_connection);
return;
}
void send(connection_hdl hdl, message_ptr msg, lib::error_code & ec);
ec = con->send(msg);
}
void send(connection_hdl hdl, message_ptr msg) {
lib::error_code ec;
send(hdl,msg,ec);
if (ec) { throw ec; }
}
void send(connection_hdl hdl, message_ptr msg);
protected:
// Import appropriate internal types from our policy classes
typedef typename concurrency_type::scoped_lock_type scoped_lock_type;

View File

@@ -87,6 +87,70 @@ endpoint<connection,config>::create_connection() {
return con;
}
template <typename connection, typename config>
void endpoint<connection,config>::interrupt(connection_hdl hdl,
lib::error_code & ec)
{
connection_ptr con = get_con_from_hdl(hdl);
if (!con) {
ec = error::make_error_code(error::bad_connection);
return;
}
m_alog.write(log::alevel::devel,"Interrupting connection"+con.get());
ec = con->interrupt();
}
template <typename connection, typename config>
void endpoint<connection,config>::interrupt(connection_hdl hdl) {
lib::error_code ec;
interrupt(hdl,ec);
if (ec) { throw ec; }
}
template <typename connection, typename config>
void endpoint<connection,config>::send(connection_hdl hdl,
const std::string& payload, frame::opcode::value op, lib::error_code & ec)
{
connection_ptr con = get_con_from_hdl(hdl);
if (!con) {
ec = error::make_error_code(error::bad_connection);
return;
}
ec = con->send(payload,op);
}
template <typename connection, typename config>
void endpoint<connection,config>::send(connection_hdl hdl, const std::string&
payload, frame::opcode::value op)
{
lib::error_code ec;
send(hdl,payload,op,ec);
if (ec) { throw ec; }
}
template <typename connection, typename config>
void endpoint<connection,config>::send(connection_hdl hdl, message_ptr msg,
lib::error_code & ec)
{
connection_ptr con = get_con_from_hdl(hdl);
if (!con) {
ec = error::make_error_code(error::bad_connection);
return;
}
ec = con->send(msg);
}
template <typename connection, typename config>
void endpoint<connection,config>::send(connection_hdl hdl, message_ptr msg) {
lib::error_code ec;
send(hdl,msg,ec);
if (ec) { throw ec; }
}
template <typename connection, typename config>
void endpoint<connection,config>::remove_connection(connection_ptr con) {
std::stringstream s;