[slime-cvs] CVS update: slime/swank.lisp

Helmut Eller heller at common-lisp.net
Wed Jan 21 22:33:45 UTC 2004


Update of /project/slime/cvsroot/slime
In directory common-lisp.net:/tmp/cvs-serv19276

Modified Files:
	swank.lisp 
Log Message:
(create-swank-server): Return the port of the serve socket.
Date: Wed Jan 21 17:33:45 2004
Author: heller

Index: slime/swank.lisp
diff -u slime/swank.lisp:1.105 slime/swank.lisp:1.106
--- slime/swank.lisp:1.105	Tue Jan 20 18:41:31 2004
+++ slime/swank.lisp	Wed Jan 21 17:33:45 2004
@@ -189,24 +189,25 @@
 
 (defun setup-server (port announce-fn background)
   (setq *write-lock* (make-lock :name "Swank write lock"))
-  (if (eq *swank-in-background* :spawn)
-      (spawn (lambda () (open-swank-socket port announce-fn nil))
-             :name "Swank")
-      (open-swank-socket port announce-fn background)))
+  (let* ((socket (create-socket port))
+         (port (local-port socket)))
+    (funcall announce-fn port)
+    (if (eq *swank-in-background* :spawn)
+        (spawn (lambda () (serve-connection socket nil)) :name "Swank")
+        (serve-connection socket background))
+    port))
 
-(defun open-swank-socket (port announce-fn background)
-  (let ((socket (create-socket port)))
-    (funcall announce-fn (local-port socket))
-    (let ((client (accept-connection socket)))
-      (close-socket socket)
-      (let ((connection (create-connection client)))
-        (init-main-connection connection)
-        (serve-requests client connection background)))))
+(defun serve-connection (socket background)
+  (let ((client (accept-connection socket)))
+    (close-socket socket)
+    (let ((connection (create-connection client)))
+      (init-main-connection connection)
+      (serve-requests client connection background))))
 
 (defun serve-requests (client connection background)
   (ecase background
-    (:fd-handler (add-input-handler 
-                  client (lambda () 
+    (:fd-handler (add-input-handler
+                  client (lambda ()
                            (loop (cond ((handle-request connection)
                                         (remove-input-handlers client)
                                         (return))





More information about the slime-cvs mailing list