Split OPEN-TCP-SERVER-SOCKET into its component parts.
authorChris Hanson <org/chris-hanson/cph>
Wed, 9 Jul 2003 04:27:03 +0000 (04:27 +0000)
committerChris Hanson <org/chris-hanson/cph>
Wed, 9 Jul 2003 04:27:03 +0000 (04:27 +0000)
v7/src/runtime/runtime.pkg
v7/src/runtime/socket.scm

index 41110766da5ea8ff94b3fff77ca6f5061873846c..1bf236c43b85674a2ca1935b14b14bd6bdbbe444 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: runtime.pkg,v 14.447 2003/06/08 05:07:12 cph Exp $
+$Id: runtime.pkg,v 14.448 2003/07/09 04:27:03 cph Exp $
 
 Copyright 1988,1989,1990,1991,1992,1993 Massachusetts Institute of Technology
 Copyright 1994,1995,1996,1997,1998,1999 Massachusetts Institute of Technology
@@ -3029,13 +3029,16 @@ USA.
   (parent (runtime))
   (export ()
          allocate-host-address
+         bind-tcp-server-socket
          canonical-host-name
          close-tcp-server-socket
+         create-tcp-server-socket
          get-host-by-address
          get-host-by-name
          get-host-name
          host-address-any
          host-address-loopback
+         listen-tcp-server-socket
          open-tcp-server-socket
          open-tcp-stream-socket
          open-tcp-stream-socket-channel
index f998ba27e2eeca4b68ff08f0aab18c79642d05ac..9db1ac97f2268cc51f23ba032889b485bcaabf7d 100644 (file)
@@ -1,6 +1,6 @@
 #| -*-Scheme-*-
 
-$Id: socket.scm,v 1.22 2003/06/08 03:36:11 cph Exp $
+$Id: socket.scm,v 1.23 2003/07/09 04:26:50 cph Exp $
 
 Copyright 1996,1997,1998,1999,2001,2002 Massachusetts Institute of Technology
 Copyright 2003 Massachusetts Institute of Technology
@@ -65,20 +65,29 @@ USA.
         ((ucode-primitive new-open-unix-stream-socket 2) filename p))))))
 \f
 (define (open-tcp-server-socket service #!optional host)
+  (let ((server-socket (create-tcp-server-socket)))
+    (bind-tcp-server-socket server-socket
+                           service
+                           (if (or (default-object? host) (not host))
+                               ((ucode-primitive host-address-any 0))
+                               host))
+    (listen-tcp-server-socket server-socket)))
+
+(define (create-tcp-server-socket)
   (open-channel
    (lambda (p)
-     (with-thread-timer-stopped
-       (lambda ()
-        (let ((channel ((ucode-primitive create-tcp-server-socket 0))))
-          (system-pair-set-cdr! p channel)
-          ((ucode-primitive bind-tcp-server-socket 3)
-           channel
-           (if (or (default-object? host) (not host))
-               ((ucode-primitive host-address-any 0))
-               host)
-           (tcp-service->port service))
-          ((ucode-primitive listen-tcp-server-socket 1) channel))
-        #t)))))
+     (system-pair-set-cdr! p ((ucode-primitive create-tcp-server-socket 0)))
+     #t)))
+
+(define (bind-tcp-server-socket server-socket service host)
+  ((ucode-primitive bind-tcp-server-socket 3)
+   (channel-descriptor server-socket)
+   host
+   (tcp-service->port service)))
+
+(define (listen-tcp-server-socket server-socket)
+  ((ucode-primitive listen-tcp-server-socket 1)
+   (channel-descriptor server-socket)))
 
 (define (tcp-service->port service)
   (if (exact-nonnegative-integer? service)