This file is indexed.

/usr/share/doc/pyro/examples/timeout/timeout.py is in pyro-examples 1:3.14-1.1.

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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import time
import Pyro.core
import Pyro.naming
from Pyro.errors import NamingError
from threading import Thread

class MySimpleServer(Thread):
    def __init__(self, daemon):
        super(MySimpleServer, self).__init__()
        self.__oDaemon = daemon
        self.__tIsRuning = False
        self.__tIsStopped = False
        self.setDaemon(True)

    def run(self):
        self.__tIsRunning = True
        while self.__tIsRunning:
            time.sleep(.1)
            self.__oDaemon.handleRequests(3)
        self.__oDaemon.shutdown()
        self.__tIsStopped = True
        print "server stopped."

    def stop(self):
        self.__tIsRunning = False

    def isStopped(self):
        return self.__tIsStopped


class MyObject(Pyro.core.ObjBase):
    def test(self):
        print 'test called'

Pyro.core.initServer()

oNs = Pyro.naming.NameServerLocator().getNS()
oDaemon = Pyro.core.Daemon()
oDaemon.useNameServer(oNs)


strTag = 'timeout_example'
try:
    oNs.unregister(strTag)
except NamingError:
    pass

oObj = MyObject()
strUri = oDaemon.connect(oObj, strTag)

oServer = MySimpleServer(oDaemon)
oServer.start()

oProxy = Pyro.core.getProxyForURI(strUri)
oProxy._setTimeout(4)

print 'calling remote method on live proxy.'
oProxy.test()
print 'success.'

print "stopping server..."
oServer.stop()
while not oServer.isStopped():
    time.sleep(.1)

print
print 'calling remote method on stale proxy.'
print 'because we specified a timeout, Pyro should take notice of this and throw a TimeoutException after a short while.'
oProxy = Pyro.core.getProxyForURI(strUri)
oProxy._setTimeout(4)
oProxy.test()
print 'This should not be shown!!! You should have seen a TimeoutException'