[slime-devel] Re: detachtty + slime

Steven E. Harris seharris at raytheon.com
Tue Apr 27 23:37:41 UTC 2004


Helmut Eller <e9626484 at stud3.tuwien.ac.at> writes:

> Fixed in CVS.

Looking at swank::setup-server, I'm not sure that passing DONT-CLOSE
through will make any difference for styles different from :spawn.

The :spawn style enables serve-connection to be called in a
loop. Keeping the server socket open has the advantage of being able
to serve more than one connection serially through the same server
socket.

If the style is not :spawn, serve-connection will only be called
once. Keeping the server socket open after that one connection gets
serviced won't help any subsequent operations.

Perhaps we should loop over several serial connections when DONT-CLOSE
is non-nil, even if we can't spawn a separate thread or process to
handle a particular connection. Here is an version, untested for the
:spawn case for lack of a suitable Lisp implementation here:


(defun setup-server (port announce-fn style dont-close)
  (declare (type function announce-fn))
  (let* ((socket (create-socket *loopback-interface* port))
         (port (local-port socket)))
    (funcall announce-fn port)
    (flet ((serve ()
             (serve-connection socket style dont-close)))
      (let ((serve-function (if dont-close
                                #'(lambda ()
                                  (loop do (serve)))
                                #'serve)))
        (case style
          (:spawn (spawn serve-function :name "Swank"))
          (otherwise (funcall serve-function)))))
    port))


To summarize, we loop if DONT-CLOSE is non-nil, serve a single
connection otherwise; spawn if STYLE is :spawn, make a normal call
otherwise.

If you don't agree with the idea of looping even when STYLE is not
:spawn, then I recommend reverting the DONT-CLOSE pass-through change
to make the DONT-CLOSE option irrelevant in the non-:spawn cases.

-- 
Steven E. Harris        :: seharris at raytheon.com
Raytheon                :: http://www.raytheon.com





More information about the slime-devel mailing list