adds an overload of get_con_from_hdl that throws

This commit is contained in:
Peter Thorson
2013-03-08 08:45:40 -06:00
parent 6f34b0f062
commit 213451370d

View File

@@ -284,7 +284,7 @@ public:
void close(connection_hdl hdl, const close::status::value code,
const std::string & reason);
/// Retrieves a connection_ptr from a connection_hdl
/// Retrieves a connection_ptr from a connection_hdl (exception free)
/**
* Converting a weak pointer to shared_ptr is not thread safe because the
* pointer could be deleted at any time.
@@ -307,6 +307,16 @@ public:
}
return con;
}
/// Retrieves a connection_ptr from a connection_hdl (exception version)
connection_ptr get_con_from_hdl(connection_hdl hdl) {
lib::error_code ec;
connection_ptr con = this->get_con_from_hdl(hdl,ec);
if (ec) {
throw ec;
}
return con;
}
protected: