00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <config.h>
00024
00025 #include "remotetcpserver.h"
00026
00027 #include <xapian/error.h>
00028
00029 #include "remoteserver.h"
00030
00031 #include <iostream>
00032
00033 using namespace std;
00034
00036 RemoteTcpServer::RemoteTcpServer(const vector<std::string> &dbpaths_,
00037 const std::string & host, int port,
00038 double active_timeout_, double idle_timeout_,
00039 bool writable_, bool verbose_)
00040 : TcpServer(host, port, true, verbose_),
00041 dbpaths(dbpaths_), writable(writable_),
00042 active_timeout(active_timeout_), idle_timeout(idle_timeout_)
00043 {
00044 }
00045
00046 void
00047 RemoteTcpServer::handle_one_connection(int socket)
00048 {
00049 try {
00050 RemoteServer sserv(dbpaths, socket, socket,
00051 active_timeout, idle_timeout, writable);
00052 sserv.run();
00053 } catch (const Xapian::NetworkTimeoutError &e) {
00054 if (verbose)
00055 cerr << "Connection timed out: " << e.get_description() << endl;
00056 } catch (const Xapian::Error &e) {
00057 cerr << "Got exception " << e.get_description() << endl;
00058 } catch (...) {
00059
00060 }
00061 }