1 /* remotetcpserver.cc: class for TCP/IP-based remote server.
3 * Copyright 1999,2000,2001 BrightStation PLC
4 * Copyright 2002 Ananova Ltd
5 * Copyright 2002,2003,2004,2005,2006,2007,2008,2010,2015 Olly Betts
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
25 #include "remotetcpserver.h"
27 #include <xapian/error.h>
29 #include "remoteserver.h"
35 /// The RemoteTcpServer constructor, taking a database and a listening port.
36 RemoteTcpServer::RemoteTcpServer(const vector
<std::string
> &dbpaths_
,
37 const std::string
& host
, int port
,
38 double active_timeout_
, double idle_timeout_
,
39 bool writable_
, bool verbose_
)
40 : TcpServer(host
, port
, true, verbose_
),
41 dbpaths(dbpaths_
), writable(writable_
),
42 active_timeout(active_timeout_
), idle_timeout(idle_timeout_
)
47 RemoteTcpServer::handle_one_connection(int socket
)
50 RemoteServer
sserv(dbpaths
, socket
, socket
,
51 active_timeout
, idle_timeout
, writable
);
52 sserv
.set_registry(reg
);
54 } catch (const Xapian::NetworkTimeoutError
&e
) {
56 cerr
<< "Connection timed out: " << e
.get_description() << endl
;
57 } catch (const Xapian::Error
&e
) {
58 cerr
<< "Got exception " << e
.get_description() << endl
;
60 // ignore other exceptions
64 #ifdef DISABLE_GPL_LIBXAPIAN
65 # error GPL source we cannot relicense included in libxapian