LCOV - code coverage report
Current view: top level - net - remotetcpserver.cc (source / functions) Hit Total Coverage
Test: Test Coverage for xapian-core r Lines: 12 13 92.3 %
Date: 2011-08-21 Functions: 4 5 80.0 %
Branches: 3 6 50.0 %

           Branch data     Line data    Source code
       1                 :            : /* remotetcpserver.cc: class for TCP/IP-based remote server.
       2                 :            :  *
       3                 :            :  * Copyright 1999,2000,2001 BrightStation PLC
       4                 :            :  * Copyright 2002 Ananova Ltd
       5                 :            :  * Copyright 2002,2003,2004,2005,2006,2007,2008,2010 Olly Betts
       6                 :            :  *
       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.
      11                 :            :  *
      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.
      16                 :            :  *
      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
      20                 :            :  * USA
      21                 :            :  */
      22                 :            : 
      23                 :            : #include <config.h>
      24                 :            : 
      25                 :            : #include "remotetcpserver.h"
      26                 :            : 
      27                 :            : #include <xapian/error.h>
      28                 :            : 
      29                 :            : #include "remoteserver.h"
      30                 :            : 
      31                 :            : #include <iostream>
      32                 :            : 
      33                 :            : using namespace std;
      34                 :            : 
      35                 :            : /// The RemoteTcpServer constructor, taking a database and a listening port.
      36                 :       1542 : 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                 :       1542 :       active_timeout(active_timeout_), idle_timeout(idle_timeout_)
      43                 :            : {
      44                 :       1542 : }
      45                 :            : 
      46                 :            : void
      47                 :        771 : RemoteTcpServer::handle_one_connection(int socket)
      48                 :            : {
      49                 :            :     try {
      50                 :            :         RemoteServer sserv(dbpaths, socket, socket,
      51                 :        771 :                            active_timeout, idle_timeout, writable);
      52                 :       1335 :         sserv.run();
      53                 :          6 :     } catch (const Xapian::NetworkTimeoutError &e) {
      54         [ +  - ]:          3 :         if (verbose)
      55                 :          3 :             cerr << "Connection timed out: " << e.get_description() << endl;
      56                 :       1122 :     } catch (const Xapian::Error &e) {
      57                 :        561 :         cerr << "Got exception " << e.get_description() << endl;
      58                 :          0 :     } catch (...) {
      59                 :            :         // ignore other exceptions
      60                 :            :     }
      61 [ +  - ][ +  - ]:       5397 : }

Generated by: LCOV version 1.8