aboutsummaryrefslogtreecommitdiffstats
path: root/libpathod/pathod.py
diff options
context:
space:
mode:
Diffstat (limited to 'libpathod/pathod.py')
-rw-r--r--libpathod/pathod.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/libpathod/pathod.py b/libpathod/pathod.py
index 1c53d7d7..3cf96206 100644
--- a/libpathod/pathod.py
+++ b/libpathod/pathod.py
@@ -145,7 +145,7 @@ class PathodHandler(tcp.BaseHandler):
)
self.info(s)
return
-
+ self.settimeout(self.server.timeout)
while not self.finished:
if not self.handle_request():
return
@@ -155,7 +155,8 @@ class Pathod(tcp.TCPServer):
LOGBUF = 500
def __init__( self,
addr, ssloptions=None, craftanchor="/p/", staticdir=None, anchors=None,
- sizelimit=None, noweb=False, nocraft=False, noapi=False, nohang=False
+ sizelimit=None, noweb=False, nocraft=False, noapi=False, nohang=False,
+ timeout=None
):
"""
addr: (address, port) tuple. If port is 0, a free port will be
@@ -175,6 +176,7 @@ class Pathod(tcp.TCPServer):
self.craftanchor = craftanchor
self.sizelimit = sizelimit
self.noweb, self.nocraft, self.noapi, self.nohang = noweb, nocraft, noapi, nohang
+ self.timeout = timeout
if not noapi:
app.api()
self.app = app.app
@@ -224,6 +226,14 @@ class Pathod(tcp.TCPServer):
)
)
return
+ except tcp.NetLibTimeout: # pragma: no cover
+ h.info("Timeout")
+ self.add_log(
+ dict(
+ type = "timeout",
+ )
+ )
+ return
def add_log(self, d):
if not self.noapi: