26 bool bind_local_address ,
const Address & local_address ,
bool sync_dns ,
27 unsigned int secure_connection_timeout ) :
28 SimpleClient(*this,remote_info,bind_local_address,local_address,sync_dns,secure_connection_timeout) ,
29 m_connect_timer(*this,&
HeapClient::onConnectionTimeout,*this) ,
30 m_delete_timer(*this,&
HeapClient::onDeletionTimeout,*this) ,
33 m_connect_timer.startTimer( 0U ) ;
40 void GNet::HeapClient::onConnectionTimeout()
46 void GNet::HeapClient::onDeletionTimeout()
52 catch( std::exception & e )
54 G_ERROR(
"HeapClientTimer::onTimeout: exception: " << e.what() ) ;
60 m_connect_timer.cancelTimer() ;
61 m_delete_timer.startTimer( 0U ) ;
62 onDeleteImp( reason ) ;
66 void GNet::HeapClient::doDeleteThis()
73 std::string reason = e.what() ;
74 G_DEBUG(
"GNet::HeapClient::onException: reason=[" << reason <<
"] finished=" << (m_finished?1:0) ) ;
75 if( m_finished ) reason.clear() ;
virtual ~HeapClient()
Destructor.
void finish()
Indicates that the last data has been sent and the client is expecting a peer disconnect.
A class for making an outgoing connection to a remote server, with support for socket-level protocols...
virtual void onDeleteImp(const std::string &reason)
An alternative to onDelete() for derived classes in the GNet namespace (in practice GNet::Client)...
HeapClient(const Location &remote_info, bool bind_local_address=false, const Address &local_address=Address::defaultAddress(), bool sync_dns=synchronousDnsDefault(), unsigned int secure_connection_timeout=0U)
Constructor.
The GNet::Address class encapsulates a TCP/UDP transport address.
virtual void onException(std::exception &) g__final override
Override from GNet::ExceptionHandler.
void doDelete(const std::string &reason)
Calls onDelete() and then does a delayed "delete this".
A class that holds a host/service name pair and the preferred address family (if any), and also the results of a name-to-address lookup, ie.
A SimpleClient class for client objects that manage their own lifetime on the heap.
virtual void onConnecting()
Called just before the connection is initiated.