[usocket-cvs] r223 - in usocket/branches/0.3.x: . backend

ehuelsmann at common-lisp.net ehuelsmann at common-lisp.net
Tue Apr 3 20:22:48 UTC 2007


Author: ehuelsmann
Date: Tue Apr  3 16:22:47 2007
New Revision: 223

Modified:
   usocket/branches/0.3.x/backend/allegro.lisp
   usocket/branches/0.3.x/backend/armedbear.lisp
   usocket/branches/0.3.x/backend/clisp.lisp
   usocket/branches/0.3.x/backend/cmucl.lisp
   usocket/branches/0.3.x/backend/lispworks.lisp
   usocket/branches/0.3.x/backend/openmcl.lisp
   usocket/branches/0.3.x/backend/sbcl.lisp
   usocket/branches/0.3.x/backend/scl.lisp   (contents, props changed)
   usocket/branches/0.3.x/usocket.lisp
Log:
Merge r220-222 from trunk.

Modified: usocket/branches/0.3.x/backend/allegro.lisp
==============================================================================
--- usocket/branches/0.3.x/backend/allegro.lisp	(original)
+++ usocket/branches/0.3.x/backend/allegro.lisp	Tue Apr  3 16:22:47 2007
@@ -60,11 +60,13 @@
 
 (defun socket-listen (host port
                            &key reuseaddress
+                           (reuse-address nil reuse-address-supplied-p)
                            (backlog 5)
                            (element-type 'character))
   ;; Allegro and OpenMCL socket interfaces bear very strong resemblence
   ;; whatever you change here, change it also for OpenMCL
-  (let ((sock (with-mapped-conditions ()
+  (let* ((reuseaddress (if reuse-address-supplied-p reuse-address reuseaddress))
+         (sock (with-mapped-conditions ()
                  (apply #'socket:make-socket
                         (append (list :connect :passive
                                       :reuse-address reuseaddress
@@ -85,20 +87,20 @@
 (defmethod get-local-address ((usocket usocket))
   (hbo-to-vector-quad (socket:local-host (socket usocket))))
 
-(defmethod get-peer-address ((usocket stream-server-usocket))
+(defmethod get-peer-address ((usocket stream-usocket))
   (hbo-to-vector-quad (socket:remote-host (socket usocket))))
 
 (defmethod get-local-port ((usocket usocket))
   (socket:local-port (socket usocket)))
 
-(defmethod get-peer-port ((usocket stream-server-usocket))
+(defmethod get-peer-port ((usocket stream-usocket))
   (socket:remote-port (socket usocket)))
 
 (defmethod get-local-name ((usocket usocket))
   (values (get-local-address usocket)
           (get-local-port usocket)))
 
-(defmethod get-peer-name ((usocket stream-server-usocket))
+(defmethod get-peer-name ((usocket stream-usocket))
   (values (get-peer-address usocket)
           (get-peer-port usocket)))
 

Modified: usocket/branches/0.3.x/backend/armedbear.lisp
==============================================================================
--- usocket/branches/0.3.x/backend/armedbear.lisp	(original)
+++ usocket/branches/0.3.x/backend/armedbear.lisp	Tue Apr  3 16:22:47 2007
@@ -33,9 +33,11 @@
 
 (defun socket-listen (host port
                            &key reuseaddress
+                           (reuse-address nil reuse-address-supplied-p)
                            (backlog 5)
                            (element-type 'character))
-  (let* ((sock-addr (jnew-call ("java.net.InetSocketAddress"
+  (let* ((reuseaddress (if reuse-address-supplied-p reuse-address reuseaddress))
+         (sock-addr (jnew-call ("java.net.InetSocketAddress"
                                 "java.lang.String" "int")
                                (host-to-hostname host) port))
          (sock (jnew-call ("java.net.ServerSocket"))))

Modified: usocket/branches/0.3.x/backend/clisp.lisp
==============================================================================
--- usocket/branches/0.3.x/backend/clisp.lisp	(original)
+++ usocket/branches/0.3.x/backend/clisp.lisp	Tue Apr  3 16:22:47 2007
@@ -51,11 +51,13 @@
 
 (defun socket-listen (host port
                            &key reuseaddress
+                           (reuse-address nil reuse-address-supplied-p)
                            (backlog 5)
                            (element-type 'character))
   ;; clisp 2.39 sets SO_REUSEADDRESS to 1 by default; no need to
-  ;; to explicitly turn it on.
-   (let ((sock (apply #'socket:socket-server
+  ;; to explicitly turn it on; unfortunately, there's no way to turn it off...
+  (declare (ignore reuseaddress reuse-address))
+  (let ((sock (apply #'socket:socket-server
                      (append (list port
                                    :backlog backlog)
                              (when (ip/= host *wildcard-host*)
@@ -87,7 +89,7 @@
       (socket:socket-stream-local (socket usocket) nil)
     (values (dotted-quad-to-vector-quad address) port)))
 
-(defmethod get-peer-name ((usocket usocket))
+(defmethod get-peer-name ((usocket stream-usocket))
   (multiple-value-bind
       (address port)
       (socket:socket-stream-peer (socket usocket) nil)
@@ -96,12 +98,12 @@
 (defmethod get-local-address ((usocket usocket))
   (nth-value 0 (get-local-name usocket)))
 
-(defmethod get-peer-address ((usocket usocket))
+(defmethod get-peer-address ((usocket stream-usocket))
   (nth-value 0 (get-peer-name usocket)))
 
 (defmethod get-local-port ((usocket usocket))
   (nth-value 1 (get-local-name usocket)))
 
-(defmethod get-peer-port ((usocket usocket))
+(defmethod get-peer-port ((usocket stream-usocket))
   (nth-value 1 (get-peer-name usocket)))
 

Modified: usocket/branches/0.3.x/backend/cmucl.lisp
==============================================================================
--- usocket/branches/0.3.x/backend/cmucl.lisp	(original)
+++ usocket/branches/0.3.x/backend/cmucl.lisp	Tue Apr  3 16:22:47 2007
@@ -72,15 +72,17 @@
 
 (defun socket-listen (host port
                            &key reuseaddress
+                           (reuse-address nil reuse-address-supplied-p)
                            (backlog 5)
                            (element-type 'character))
- (let ((server-sock (apply #'ext:create-inet-listener
-                           (append (list port :stream
-                                         :backlog backlog
-                                         :reuse-address reuseaddress)
-                                   (when (ip/= host *wildcard-host*)
-                                     (list :host
-                                           (host-to-hbo host)))))))
+ (let* ((reuseaddress (if reuse-address-supplied-p reuse-address reuseaddress))
+        (server-sock (apply #'ext:create-inet-listener
+                            (append (list port :stream
+                                          :backlog backlog
+                                          :reuse-address reuseaddress)
+                                    (when (ip/= host *wildcard-host*)
+                                      (list :host
+                                            (host-to-hbo host)))))))
    (make-stream-server-socket server-sock :element-type element-type)))
 
 (defmethod socket-accept ((usocket stream-server-usocket) &key element-type)
@@ -110,7 +112,7 @@
       (ext:get-socket-host-and-port (socket usocket))
     (values (hbo-to-vector-quad address) port)))
 
-(defmethod get-peer-name ((usocket usocket))
+(defmethod get-peer-name ((usocket stream-usocket))
   (multiple-value-bind
       (address port)
       (ext:get-peer-host-and-port (socket usocket))
@@ -119,13 +121,13 @@
 (defmethod get-local-address ((usocket usocket))
   (nth-value 0 (get-local-name usocket)))
 
-(defmethod get-peer-address ((usocket usocket))
+(defmethod get-peer-address ((usocket stream-usocket))
   (nth-value 0 (get-peer-name usocket)))
 
 (defmethod get-local-port ((usocket usocket))
   (nth-value 1 (get-local-name usocket)))
 
-(defmethod get-peer-port ((usocket usocket))
+(defmethod get-peer-port ((usocket stream-usocket))
   (nth-value 1 (get-peer-name usocket)))
 
 

Modified: usocket/branches/0.3.x/backend/lispworks.lisp
==============================================================================
--- usocket/branches/0.3.x/backend/lispworks.lisp	(original)
+++ usocket/branches/0.3.x/backend/lispworks.lisp	Tue Apr  3 16:22:47 2007
@@ -58,9 +58,11 @@
 
 (defun socket-listen (host port
                            &key reuseaddress
+                           (reuse-address nil reuse-address-supplied-p)
                            (backlog 5)
                            (element-type 'base-char))
-  (let* ((comm::*use_so_reuseaddr* reuseaddress)
+  (let* ((reuseaddress (if reuse-address-supplied-p reuse-address reuseaddress))
+         (comm::*use_so_reuseaddr* reuseaddress)
          (hostname (host-to-hostname host))
          (sock (with-mapped-conditions ()
                   #-lispworks4.1 (comm::create-tcp-socket-for-service
@@ -94,7 +96,7 @@
       (comm:get-socket-address (socket usocket))
     (values (hbo-to-vector-quad address) port)))
 
-(defmethod get-peer-name ((usocket usocket))
+(defmethod get-peer-name ((usocket stream-usocket))
   (multiple-value-bind
       (address port)
       (comm:get-socket-peer-address (socket usocket))
@@ -103,13 +105,13 @@
 (defmethod get-local-address ((usocket usocket))
   (nth-value 0 (get-local-name usocket)))
 
-(defmethod get-peer-address ((usocket usocket))
+(defmethod get-peer-address ((usocket stream-usocket))
   (nth-value 0 (get-peer-name usocket)))
 
 (defmethod get-local-port ((usocket usocket))
   (nth-value 1 (get-local-name usocket)))
 
-(defmethod get-peer-port ((usocket usocket))
+(defmethod get-peer-port ((usocket stream-usocket))
   (nth-value 1 (get-peer-name usocket)))
 
 (defun get-hosts-by-name (name)

Modified: usocket/branches/0.3.x/backend/openmcl.lisp
==============================================================================
--- usocket/branches/0.3.x/backend/openmcl.lisp	(original)
+++ usocket/branches/0.3.x/backend/openmcl.lisp	Tue Apr  3 16:22:47 2007
@@ -56,9 +56,11 @@
 
 (defun socket-listen (host port
                            &key reuseaddress
+                           (reuse-address nil reuse-address-supplied-p)
                            (backlog 5)
                            (element-type 'character))
-  (let* ((sock (apply #'openmcl-socket:make-socket
+  (let* ((reuseaddress (if reuse-address-supplied-p reuse-address reuseaddress))
+         (sock (apply #'openmcl-socket:make-socket
                       (append (list :connect :passive
                                     :reuse-address reuseaddress
                                     :local-port port
@@ -83,20 +85,20 @@
 (defmethod get-local-address ((usocket usocket))
   (hbo-to-vector-quad (openmcl-socket:local-host (socket usocket))))
 
-(defmethod get-peer-address ((usocket usocket))
+(defmethod get-peer-address ((usocket stream-usocket))
   (hbo-to-vector-quad (openmcl-socket:remote-host (socket usocket))))
 
 (defmethod get-local-port ((usocket usocket))
   (openmcl-socket:local-port (socket usocket)))
 
-(defmethod get-peer-port ((usocket usocket))
+(defmethod get-peer-port ((usocket stream-usocket))
   (openmcl-socket:remote-port (socket usocket)))
 
 (defmethod get-local-name ((usocket usocket))
   (values (get-local-address usocket)
           (get-local-port usocket)))
 
-(defmethod get-peer-name ((usocket usocket))
+(defmethod get-peer-name ((usocket stream-usocket))
   (values (get-peer-address usocket)
           (get-peer-port usocket)))
 

Modified: usocket/branches/0.3.x/backend/sbcl.lisp
==============================================================================
--- usocket/branches/0.3.x/backend/sbcl.lisp	(original)
+++ usocket/branches/0.3.x/backend/sbcl.lisp	Tue Apr  3 16:22:47 2007
@@ -84,9 +84,11 @@
 
 (defun socket-listen (host port
                            &key reuseaddress
+                           (reuse-address nil reuse-address-supplied-p)
                            (backlog 5)
                            (element-type 'character))
-  (let* ((ip (host-to-vector-quad host))
+  (let* ((reuseaddress (if reuse-address-supplied-p reuse-address reuseaddress))
+         (ip (host-to-vector-quad host))
          (sock (make-instance 'sb-bsd-sockets:inet-socket
                               :type :stream :protocol :tcp)))
     (setf (sb-bsd-sockets:sockopt-reuse-address sock) reuseaddress)
@@ -116,19 +118,19 @@
 (defmethod get-local-name ((usocket usocket))
   (sb-bsd-sockets:socket-name (socket usocket)))
 
-(defmethod get-peer-name ((usocket usocket))
+(defmethod get-peer-name ((usocket stream-usocket))
   (sb-bsd-sockets:socket-peername (socket usocket)))
 
 (defmethod get-local-address ((usocket usocket))
   (nth-value 0 (get-local-name usocket)))
 
-(defmethod get-peer-address ((usocket usocket))
+(defmethod get-peer-address ((usocket stream-usocket))
   (nth-value 0 (get-peer-name usocket)))
 
 (defmethod get-local-port ((usocket usocket))
   (nth-value 1 (get-local-name usocket)))
 
-(defmethod get-peer-port ((usocket usocket))
+(defmethod get-peer-port ((usocket stream-usocket))
   (nth-value 1 (get-peer-name usocket)))
 
 

Modified: usocket/branches/0.3.x/backend/scl.lisp
==============================================================================
--- usocket/branches/0.3.x/backend/scl.lisp	(original)
+++ usocket/branches/0.3.x/backend/scl.lisp	Tue Apr  3 16:22:47 2007
@@ -1,5 +1,5 @@
-;;;; $Id: scl.lisp$
-;;;; $URL: svn://common-lisp.net/project/usocket/svn/usocket/trunk/backend/scl.lisp $
+;;;; $Id$
+;;;; $URL$
 
 ;;;; See LICENSE for licensing information.
 
@@ -43,15 +43,17 @@
 
 (defun socket-listen (host port
                            &key reuseaddress
+                           (reuse-address nil reuse-address-supplied-p)
                            (backlog 5)
                            (element-type 'character))
-  (let* ((host (if (ip= host *wildcard-host*)
-                  0
-                  (host-to-hbo host)))
-        (server-sock (ext:create-inet-listener port :stream
-                                               :host host
-                                               :reuse-address reuseaddress
-                                               :backlog backlog)))
+  (let* ((reuseaddress (if reuse-address-supplied-p reuse-address reuseaddress))
+         (host (if (ip= host *wildcard-host*)
+                   0
+                 (host-to-hbo host)))
+         (server-sock (ext:create-inet-listener port :stream
+                                                :host host
+                                                :reuse-address reuseaddress
+                                                :backlog backlog)))
    (make-stream-server-socket server-sock :element-type element-type)))
 
 (defmethod socket-accept ((usocket stream-server-usocket) &key element-type)
@@ -82,7 +84,7 @@
         (ext:get-socket-host-and-port (socket usocket)))
     (values (hbo-to-vector-quad address) port)))
 
-(defmethod get-peer-name ((usocket usocket))
+(defmethod get-peer-name ((usocket stream-usocket))
   (multiple-value-bind (address port)
       (with-mapped-conditions (usocket)
         (ext:get-peer-host-and-port (socket usocket)))
@@ -91,13 +93,13 @@
 (defmethod get-local-address ((usocket usocket))
   (nth-value 0 (get-local-name usocket)))
 
-(defmethod get-peer-address ((usocket usocket))
+(defmethod get-peer-address ((usocket stream-usocket))
   (nth-value 0 (get-peer-name usocket)))
 
 (defmethod get-local-port ((usocket usocket))
   (nth-value 1 (get-local-name usocket)))
 
-(defmethod get-peer-port ((usocket usocket))
+(defmethod get-peer-port ((usocket stream-usocket))
   (nth-value 1 (get-peer-name usocket)))
 
 

Modified: usocket/branches/0.3.x/usocket.lisp
==============================================================================
--- usocket/branches/0.3.x/usocket.lisp	(original)
+++ usocket/branches/0.3.x/usocket.lisp	Tue Apr  3 16:22:47 2007
@@ -304,9 +304,11 @@
 
 Returns an object of type `stream-server-usocket'.
 
-`reuseaddress' and `backlog' are advisory parameters for setting socket
+`reuse-address' and `backlog' are advisory parameters for setting socket
 options at creation time. `element-type' is the element type of the
-streams to be created by `socket-accept'.
+streams to be created by `socket-accept'.  `reuseaddress' is supported for
+backward compatibility (but deprecated); when both `reuseaddress' and
+`reuse-address' have been specified, the latter takes precedence.
 ")
 
 ;; Documentation for the function



More information about the usocket-cvs mailing list