Intra2net AG

libt2n::ReconnectIgnoreFailureSocketWrapper Class Reference

a wrapper implementing reconnect-then-ignore More...

#include <socket_wrapper.hxx>

Inheritance diagram for libt2n::ReconnectIgnoreFailureSocketWrapper:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 ReconnectIgnoreFailureSocketWrapper (int _port, const std::string &_server="127.0.0.1", long long _connect_timeout_usec=socket_client_connection::connect_timeout_usec_default, int _max_retries=socket_client_connection::max_retries_default)
 ReconnectIgnoreFailureSocketWrapper (const std::string &_path, long long _connect_timeout_usec=socket_client_connection::connect_timeout_usec_default, int _max_retries=socket_client_connection::max_retries_default)
client_connectionget_connection (void)
 return active connection, return a dummy-connection if we can't establish one
bool handle (command_client *stubBase, boost::function< void() > f)
 try to execute the command, may ignore the command if server not available
bool connection_established (void)
void set_logging (std::ostream *_logstream, log_level_values _log_level)
 set logging for coming and current connections
long long get_command_timeout_usec (void)
void set_command_timeout_usec (long long _command_timeout_usec)
long long get_hello_timeout_usec (void)
void set_hello_timeout_usec (long long _hello_timeout_usec)
std::ostream * get_logstream (log_level_values level)
 get pointer to logging stream, returns NULL if no logging needed

Protected Member Functions

void set_logging_on_connection (client_connection &c)
 always call this when you got a new connection to transfer logging settings

Protected Attributes

socket_type_value socket_type
std::string path
std::string server
int port
long long connect_timeout_usec
int max_retries
std::auto_ptr
< socket_client_connection
c
log_level_values log_level
std::ostream * logstream

Private Attributes

dummy_client_connection dc

Detailed Description

a wrapper implementing reconnect-then-ignore

This ConnectionWrapper tries to reconnect to the server if something with the connection goes wrong. If even reconnecting max_retries times does not help, the complete t2n-call is ignored. The return value of the call will be created with the default constructor.


Constructor & Destructor Documentation

libt2n::ReconnectIgnoreFailureSocketWrapper::ReconnectIgnoreFailureSocketWrapper ( int  _port,
const std::string &  _server = "127.0.0.1",
long long  _connect_timeout_usec = socket_client_connection::connect_timeout_usec_default,
int  _max_retries = socket_client_connection::max_retries_default 
) [inline]
libt2n::ReconnectIgnoreFailureSocketWrapper::ReconnectIgnoreFailureSocketWrapper ( const std::string &  _path,
long long  _connect_timeout_usec = socket_client_connection::connect_timeout_usec_default,
int  _max_retries = socket_client_connection::max_retries_default 
) [inline]

Member Function Documentation

bool libt2n::BasicSocketWrapper::connection_established ( void   )  [inline, inherited]
long long libt2n::ConnectionWrapper::get_command_timeout_usec ( void   )  [inline, inherited]
client_connection * libt2n::ReconnectIgnoreFailureSocketWrapper::get_connection ( void   )  [virtual]

return active connection, return a dummy-connection if we can't establish one

Reimplemented from libt2n::BasicSocketWrapper.

References libt2n::BasicSocketWrapper::c, dc, and libt2n::connection::is_closed().

Referenced by handle().

long long libt2n::ConnectionWrapper::get_hello_timeout_usec ( void   )  [inline, inherited]
std::ostream * libt2n::ConnectionWrapper::get_logstream ( log_level_values  level  )  [inherited]

get pointer to logging stream, returns NULL if no logging needed

References libt2n::ConnectionWrapper::log_level, and libt2n::ConnectionWrapper::logstream.

bool libt2n::ReconnectIgnoreFailureSocketWrapper::handle ( command_client stubBase,
boost::function< void() >  f 
) [virtual]
void libt2n::ConnectionWrapper::set_command_timeout_usec ( long long  _command_timeout_usec  )  [inline, inherited]
void libt2n::ConnectionWrapper::set_hello_timeout_usec ( long long  _hello_timeout_usec  )  [inline, inherited]
void libt2n::BasicSocketWrapper::set_logging ( std::ostream *  _logstream,
log_level_values  _log_level 
) [virtual, inherited]
void libt2n::ConnectionWrapper::set_logging_on_connection ( client_connection c  )  [protected, inherited]

always call this when you got a new connection to transfer logging settings

References libt2n::ConnectionWrapper::log_level, libt2n::ConnectionWrapper::logstream, libt2n::none, and libt2n::client_connection::set_logging().


Member Data Documentation

std::auto_ptr<socket_client_connection> libt2n::BasicSocketWrapper::c [protected, inherited]
long long libt2n::BasicSocketWrapper::connect_timeout_usec [protected, inherited]

Referenced by get_connection(), and handle().

std::ostream* libt2n::ConnectionWrapper::logstream [protected, inherited]
int libt2n::BasicSocketWrapper::max_retries [protected, inherited]
std::string libt2n::BasicSocketWrapper::path [protected, inherited]
int libt2n::BasicSocketWrapper::port [protected, inherited]
std::string libt2n::BasicSocketWrapper::server [protected, inherited]

The documentation for this class was generated from the following files:

Generated on 13 May 2015 by  doxygen 1.6.1
© Intra2net AG 2024 | Legal | Contact