23 #ifndef ClientBase20100628H 24 #define ClientBase20100628H 26 #include "connection.h" 27 #include "interface.h" 36 template <
typename ASIOAsyncReadStream>
42 retry_interval_(retry_interval)
48 virtual ASIOAsyncReadStream& socket() = 0;
49 virtual std::string local_endpoint() = 0;
50 virtual std::string remote_endpoint() = 0;
57 set_active(start_specific());
59 LineBasedInterface::io_service().post(
62 LineBasedInterface::io_service().post(
66 virtual bool start_specific() = 0;
73 if (!write_in_progress)
74 LineBasedInterface::io_service().post(
79 void do_close(
const boost::system::error_code& error)
82 boost::asio::error::operation_aborted)
89 if (error != boost::system::error_code())
93 if (now - seconds(retry_interval_) < last_start_time_)
94 LineBasedInterface::sleep(retry_interval_ -
95 (now - last_start_time_).total_seconds());
98 LineBasedInterface::start();
103 void socket_close(
const boost::system::error_code& error) { do_close(error); }
106 boost::posix_time::ptime last_start_time_;
ReturnType goby_time()
Returns current UTC time as a boost::posix_time::ptime.
The global namespace for the Goby project.
basic interface class for all the derived serial (and networking mimics) line-based nodes (serial...