Exemplo n.º 1
0
	void on_accept(connection_ptr conn, error_code ec)
	{
		if (!ec)
		{
			connections_.insert(conn);

			std::cout<<"accept: "<<conn->remote_endpoint(ec)<<std::endl;

			conn->disconnected_signal().bind(&this_type::on_disconnected,this,conn.get());
			conn->received_request_header_signal().bind(&this_type::on_request,this,_1,conn.get());
			conn->received_data_signal().bind(&this_type::on_data,this,_1);
			conn->writable_signal().bind(&this_type::close_socket,this,conn.get());
		}

	}
Exemplo n.º 2
0
void PhronesisAgent::handle_accept(const boost::system::error_code& error,
		connection_ptr new_connection) {
	if (!error) {
		std::string s =
				new_connection.get()->socket().remote_endpoint().address().to_string();
		std::cout << "Accepted connection from " << s << std::endl;
		Treatment_ptr session = Treatment::create(new_connection);

		//Shall we call wait_for_connection even if there is an error?
		wait_for_connection();
	} else {
		std::cerr << "Connection refusee" << std::endl;
	}
}
Exemplo n.º 3
0
 bool operator()(const connection_ptr& p1, const connection_ptr& p2)
 {
     return p1.get() < p2.get();
 }