mirror of
https://github.com/XRPLF/rippled.git
synced 2026-04-29 15:37:57 +00:00
updates asio on_tcp_init callback to new api
This commit is contained in:
@@ -85,6 +85,10 @@ void on_interrupt(server* s, websocketpp::connection_hdl hdl) {
|
||||
std::cout << "on_interrupt called with hdl: " << hdl.lock().get() << std::endl;
|
||||
}
|
||||
|
||||
void on_tcp_init(websocketpp::connection_hdl hdl) {
|
||||
std::cout << "on_tcp_init called with hdl: " << hdl.lock().get() << std::endl;
|
||||
}
|
||||
|
||||
using websocketpp::lib::placeholders::_1;
|
||||
using websocketpp::lib::bind;
|
||||
|
||||
@@ -101,6 +105,7 @@ int main() {
|
||||
//echo_server.set_open_handler(websocketpp::lib::bind(&test_handler::on_open,t,websocketpp::lib::placeholders::_1));
|
||||
echo_server.set_open_handler(bind(&on_open,&echo_server,::_1));
|
||||
echo_server.set_interrupt_handler(bind(&on_interrupt,&echo_server,::_1));
|
||||
echo_server.set_tcp_init_handler(&on_tcp_init);
|
||||
|
||||
// Listen
|
||||
echo_server.listen(9002);
|
||||
|
||||
@@ -57,7 +57,6 @@ public:
|
||||
|
||||
class handler_interface : public security_type::handler_interface {
|
||||
public:
|
||||
virtual void on_tcp_init() {};
|
||||
};
|
||||
|
||||
typedef lib::shared_ptr<handler_interface> handler_ptr;
|
||||
@@ -120,8 +119,8 @@ protected:
|
||||
}
|
||||
|
||||
void handle_init(init_handler callback, const lib::error_code& ec) {
|
||||
if (!ec) {
|
||||
m_handler->on_tcp_init();
|
||||
if (m_tcp_init_handler) {
|
||||
m_tcp_init_handler(m_connection_hdl);
|
||||
}
|
||||
|
||||
callback(ec);
|
||||
|
||||
@@ -160,6 +160,9 @@ public:
|
||||
* @see WebSocket++ handler documentation for more information about
|
||||
* handlers.
|
||||
*/
|
||||
void set_tcp_init_handler(tcp_init_handler h) {
|
||||
m_tcp_init_handler = h;
|
||||
}
|
||||
|
||||
// listen manually
|
||||
void listen(const boost::asio::ip::tcp::endpoint& e) {
|
||||
|
||||
Reference in New Issue
Block a user