static bool on_hello_request(const std::string& name, fscp::server& server, const fscp::server::ep_type& sender, bool default_accept) { std::cout << "[" << name << "] Received HELLO request from " << sender << std::endl; server.async_introduce_to(sender); return default_accept; }
static bool on_hello(const std::string& name, fscp::server& server, const fscp::server::ep_type& sender, bool default_accept) { static_cast<void>(server); mutex::scoped_lock lock(output_mutex); std::cout << "[" << name << "] Received HELLO request from " << sender << " (default accept is: " << default_accept << ")" << std::endl; server.async_introduce_to(sender, boost::bind(&simple_handler, name, "async_introduce_to()", _1)); return default_accept; }
static void on_hello_response(const std::string& name, fscp::server& server, const fscp::server::ep_type& sender, const boost::posix_time::time_duration& time_duration, bool success) { if (!success) { std::cout << "[" << name << "] Received no HELLO response from " << sender << " after " << time_duration.total_milliseconds() << " ms" << std::endl; } else { std::cout << "[" << name << "] Received HELLO response from " << sender << " (" << time_duration.total_milliseconds() << " ms)" << std::endl; server.async_introduce_to(sender); } }
static void on_hello_response(const std::string& name, fscp::server& server, const fscp::server::ep_type& sender, const boost::system::error_code& ec, const boost::posix_time::time_duration& duration) { mutex::scoped_lock lock(output_mutex); if (ec) { std::cout << "[" << name << "] Received no HELLO response from " << sender << " after " << duration << ": " << ec.message() << std::endl; } else { std::cout << "[" << name << "] Received HELLO response from " << sender << " after " << duration << ": " << ec.message() << std::endl; server.async_introduce_to(sender, boost::bind(&simple_handler, name, "async_introduce_to()", _1)); std::cout << "[" << name << "] Sending a presentation message to " << sender << std::endl; } }