[usocket-devel] "principle of least surprise"

James Ashley james.ashley at gmail.com
Tue Feb 1 14:26:23 UTC 2011


This stupid-simple patch lets you pass a wider variety of address specifications
into socket-listen (Clozure's make-socket seems to require either an int or a
string address).

Well, I think it does, and I don't think it has much performance implications.
But I'm a CL noob, and I won't pretend to know all that much about socket
programming, so I could be totally wrong about this.

Thanks,
James

--- backend/openmcl.lisp~       2011-01-13 18:57:39.000000000 -0600
+++ backend/openmcl.lisp        2011-01-30 10:11:39.000000000 -0600
@@ -118,6 +118,7 @@
                            (backlog 5)
                            (element-type 'character))
   (let* ((reuseaddress (if reuse-address-supplied-p reuse-address
reuseaddress))
+        (real-host (host-to-hostname host))
          (sock (with-mapped-conditions ()
                   (apply #'openmcl-socket:make-socket
                          (append (list :connect :passive
@@ -126,7 +127,7 @@
                                        :backlog backlog
                                        :format (to-format element-type))
                                  (when (ip/= host *wildcard-host*)
-                                   (list :local-host host)))))))
+                                   (list :local-host real-host)))))))
     (make-stream-server-socket sock :element-type element-type)))

 (defmethod socket-accept ((usocket stream-server-usocket) &key element-type)




More information about the usocket-devel mailing list