[usocket-devel] bug in backend/sbcl.lisp ?

Robert Brown robert.brown at gmail.com
Fri Sep 23 18:09:12 UTC 2011


I think the socket-connect function in the SBCL backend
is incorrectly calling bind when creating a client stream
socket.

With the current code, when I create a lot of client stream
sockets on a Linux system, the bind call in socket-connect
eventually returns an error, address already in use.  I don't
think the bind call is needed for the client end of stream
sockets.

The following patch appears to fix the problem for me.

bob


--- backend/sbcl.lisp.~1~	2011-09-23 13:46:55.071765010 -0400
+++ backend/sbcl.lisp	2011-09-23 13:51:33.841811680 -0400
@@ -269,9 +269,8 @@
                                :protocol (case protocol
                                            (:stream :tcp)
                                            (:datagram :udp))))
-        (local-host (host-to-vector-quad (or local-host *wildcard-host*)))
-        (local-port (or local-port *auto-port*))
-        usocket ok)
+        (usocket nil)
+        (ok nil))
     (unwind-protect
          (progn
            (ecase protocol
@@ -284,8 +283,6 @@
               ;;         to pass compilation on ECL without it.
               (when (and nodelay-specified sockopt-tcp-nodelay-p)
                 (setf (sb-bsd-sockets::sockopt-tcp-nodelay socket) nodelay))
-              (when (or local-host local-port)
-                (sb-bsd-sockets:socket-bind socket local-host local-port))
               (with-mapped-conditions (usocket)
 		#+(and sbcl (not win32))
 		(labels ((connect ()




More information about the usocket-devel mailing list