This file is indexed.

/usr/share/doc/libkyototycoon2/example/ktthservex.cc is in kyototycoon-doc 0.9.56-1build2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#include <ktthserv.h>

using namespace std;
using namespace kyototycoon;

// the flag whether the server is alive
ThreadedServer* g_serv = NULL;

// stop the running server
static void stopserver(int signum) {
  if (g_serv) g_serv->stop();
  g_serv = NULL;
}

// main routine
int main(int argc, char** argv) {

  // set the signal handler to stop the server
  setkillsignalhandler(stopserver);

  // prepare the worker
  class Worker : public ThreadedServer::Worker {
    bool process(ThreadedServer* serv, ThreadedServer::Session* sess) {
      bool keep = false;
      // read a line from the client socket
      char line[1024];
      if (sess->receive_line(line, sizeof(line))) {
        if (!kc::stricmp(line, "/quit")) {
          // process the quit command
          sess->printf("> Bye!\n");
        } else {
          // echo back the message
          sess->printf("> %s\n", line);
          keep = true;
        }
      }
      return keep;
    }
  };
  Worker worker;

  // prepare the server
  ThreadedServer serv;
  serv.set_network("127.0.0.1:1978", 1.0);
  serv.set_worker(&worker, 4);
  g_serv = &serv;

  // start the server and block until its stop
  serv.start();

  // clean up connections and other resources
  serv.finish();

  return 0;
}