+ self.waittime = waittime or 0.1
+ self.timeout = timeout or 90
+end
+
+function Daemon.remove_dead(self, thread)
+ if self.debug then
+ self:dprint("Completed " .. tostring(thread))
+ end
+ thread.socket:close()
+ self.threadc = self.threadc - 1
+ self.threads[thread.socket] = nil
+end
+
+function Daemon.kill_timedout(self)
+ local now = os.time()
+
+ for sock, thread in pairs(self.threads) do
+ if os.difftime(now, thread:touched()) > self.timeout then
+ self.threads[sock] = nil
+ self.threadc = self.threadc - 1
+ sock:close()
+ end
+ end