#include <replicatetcpclient.h>

Public Member Functions | |
| ReplicateTcpClient (const std::string &hostname, int port, double timeout_connect) | |
| Constructor. | |
| void | update_from_master (const std::string &path, const std::string &remotedb, Xapian::ReplicationInfo &info, double reader_close_time) |
| ~ReplicateTcpClient () | |
| Destructor. | |
| TcpServer (const std::string &host, int port, bool tcp_nodelay, bool verbose) | |
| Construct a TcpServer and start listening for connections. | |
| virtual | ~TcpServer () |
| Destructor. | |
| void | run () |
| Accept connections and service requests indefinitely. | |
| void | run_once () |
| Accept a single connection, service requests on it, then stop. | |
| virtual void | handle_one_connection (int socket)=0 |
| Handle a single connection on an already connected socket. | |
Protected Member Functions | |
| int | accept_connection () |
| Accept a connection and return the filedescriptor for it. | |
Protected Attributes | |
| bool | verbose |
| Should we produce output when connections are made or lost? | |
Private Member Functions | |
| void | operator= (const ReplicateTcpClient &) |
| Don't allow assignment. | |
| ReplicateTcpClient (const ReplicateTcpClient &) | |
| Don't allow copying. | |
| void | operator= (const TcpServer &) |
| Don't allow assignment. | |
| TcpServer (const TcpServer &) | |
| Don't allow copying. | |
Static Private Member Functions | |
| static int | open_socket (const std::string &hostname, int port, double timeout_connect) |
| Attempt to open a TCP/IP socket connection to a replication server. | |
| static int | get_listening_socket (const std::string &host, int port, bool tcp_nodelay) |
| Create a listening socket ready to accept connections. | |
Private Attributes | |
| int | socket |
| The socket fd. | |
| RemoteConnection | remconn |
| Write-only connection to the server. | |
| int | listen_socket |
| The socket we're listening on. | |
TCP/IP socket based server for RemoteDatabase.
This class implements the server used by xapian-tcpsrv.
Definition at line 36 of file replicatetcpclient.h.
| SOCKET_INITIALIZER_MIXIN::~ReplicateTcpClient | ( | ) |
Destructor.
| virtual SOCKET_INITIALIZER_MIXIN::~TcpServer | ( | ) | [virtual] |
Destructor.
| int SOCKET_INITIALIZER_MIXIN::accept_connection | ( | ) | [protected] |
Accept a connection and return the filedescriptor for it.
| static int SOCKET_INITIALIZER_MIXIN::get_listening_socket | ( | const std::string & | host, | |
| int | port, | |||
| bool | tcp_nodelay | |||
| ) | [static, private] |
Create a listening socket ready to accept connections.
| host | hostname or address to listen on or an empty string to accept connections on any interface. | |
| port | TCP port to listen on. | |
| tcp_nodelay | If true, enable TCP_NODELAY option. |
| virtual void SOCKET_INITIALIZER_MIXIN::handle_one_connection | ( | int | socket | ) | [pure virtual] |
Handle a single connection on an already connected socket.
| static int SOCKET_INITIALIZER_MIXIN::open_socket | ( | const std::string & | hostname, | |
| int | port, | |||
| double | timeout_connect | |||
| ) | [static, private] |
Attempt to open a TCP/IP socket connection to a replication server.
Connect to replication server running on port port of host hostname. Give up trying to connect after timeout_connect seconds.
Note: this method is called early on during class construction before any member variables or even the base class have been initialised. To help avoid accidentally trying to use member variables or call other methods which do, this method has been deliberately made "static".
| void SOCKET_INITIALIZER_MIXIN::operator= | ( | const TcpServer & | ) | [private] |
Don't allow assignment.
| void SOCKET_INITIALIZER_MIXIN::operator= | ( | const ReplicateTcpClient & | ) | [private] |
Don't allow assignment.
| SOCKET_INITIALIZER_MIXIN::ReplicateTcpClient | ( | const std::string & | hostname, | |
| int | port, | |||
| double | timeout_connect | |||
| ) |
Constructor.
Connect to replication server running on port port of host hostname. Give up trying to connect after timeout_connect seconds.
| timeout_connect | Timeout for trying to connect (in seconds). |
| SOCKET_INITIALIZER_MIXIN::ReplicateTcpClient | ( | const ReplicateTcpClient & | ) | [private] |
Don't allow copying.
| void SOCKET_INITIALIZER_MIXIN::run | ( | ) |
Accept connections and service requests indefinitely.
This method runs the TcpServer as a daemon which accepts a connection and forks itself (or creates a new thread under Windows) to serve the request while continuing to listen for more connections.
| void SOCKET_INITIALIZER_MIXIN::run_once | ( | ) |
Accept a single connection, service requests on it, then stop.
| SOCKET_INITIALIZER_MIXIN::TcpServer | ( | const std::string & | host, | |
| int | port, | |||
| bool | tcp_nodelay, | |||
| bool | verbose | |||
| ) |
Construct a TcpServer and start listening for connections.
| host | The hostname or address for the interface to listen on (or "" to listen on all interfaces). | |
| port | The TCP port number to listen on. | |
| tcp_nodelay | If true, enable TCP_NODELAY option. | |
| verbose | Should we produce output when connections are made or lost? |
| SOCKET_INITIALIZER_MIXIN::TcpServer | ( | const TcpServer & | ) | [private] |
Don't allow copying.
| void SOCKET_INITIALIZER_MIXIN::update_from_master | ( | const std::string & | path, | |
| const std::string & | remotedb, | |||
| Xapian::ReplicationInfo & | info, | |||
| double | reader_close_time | |||
| ) |
int SOCKET_INITIALIZER_MIXIN::listen_socket [private] |
int SOCKET_INITIALIZER_MIXIN::socket [private] |
bool SOCKET_INITIALIZER_MIXIN::verbose [protected] |
Should we produce output when connections are made or lost?
Definition at line 74 of file tcpserver.h.