Commit 7e161444 authored by james's avatar james
Browse files

Minor changes to ACCEPT-CONNECTION and CYCLE-MASTER-THREAD.

Of course, I still haven't even compiled this so I have no clue whether those
even work yet, but who cares.
parent 890ac8fb
;;;; ltelnetd.lisp -- Lisp Telnet daemon.
;;;;
;;;; $Id: ltelnetd.lisp,v 1.4 2004/01/24 11:08:26 james Exp $
;;;; $Id: ltelnetd.lisp,v 1.5 2004/01/30 06:00:28 james Exp $
;;;;
;;;; Copyfnord (K) 3170 James A. Crippen <james@unlambda.com>,
;;;; Martin Rydstrom <rydis@cd.chalmers.se>
......@@ -223,12 +223,13 @@ connections."
(let ((stream (accept listener)))
(setf (telnet-thread-state thread) 'connected)
(unwind-protect
(filter-telnet-session stream (telnet-listener-handler listener))
(funcall (telnet-listener-handler listener) stream listener)
(setf (telnet-thread-state thread) 'finished)
(setf (telnet-thread-last-hit thread) (get-universal-time))
(forcibly-close-stream stream)))))
;;; FIXME: Question - Is there a reason that this isn't a method of TELNET-LISTENER?
;;; FIXME: Question - Is there a reason that this isn't a method of TELNET-
;;; LISTENER?
(defun make-listener-thread (listener)
"Creates a Telnet listener thread."
(declare (type telnet-listener listener))
......@@ -240,6 +241,8 @@ connections."
(values thread)))
(defmethod cycle-master-thread ((listener telnet-listener))
"Execute one cycle of the master thread, doing bookkeeping on listener
threads, spawning new threads and killing stale ones."
(let ((min (telnet-listener-min-spare listener))
(max (telnet-listener-max-spare listener))
(spares 0))
......@@ -274,6 +277,7 @@ connections."
(telnet-listener-threads listener))))
(when (<= min spares max)
(sleep 60))
;; FIXME: Do something about spares > max.
(sleep 1)))
(defmethod start-listening ((listener telnet-listener) &key (num-threads 5))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment