[usocket-devel] bug in backend/sbcl.lisp ?
Robert Brown
robert.brown at gmail.com
Fri Sep 23 19:20:25 UTC 2011
On Fri, Sep 23, 2011 at 2:59 PM, Anton Kovalenko <anton at sw4me.com>
wrote:> Bind is not needed unless we want a specific interface or a
specific> client port.
Seems like a better patch is the following, which calls bind if
local-hostor local-port are specified in the call to socket-connect.
--- third_party/lisp/usocket/backend/sbcl.lisp.~1~ 2011-08-12
16:23:26.718704693 -0400
+++ third_party/lisp/usocket/backend/sbcl.lisp 2011-09-23
15:11:24.481814325 -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
@@ -285,7 +284,9 @@
(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))
+ (sb-bsd-sockets:socket-bind socket
+ (host-to-vector-quad (or
local-host *wildcard-host*))
+ (or local-port *auto-port*)))
(with-mapped-conditions (usocket)
#+sbcl
(labels ((connect ()
@@ -306,8 +307,7 @@
(:datagram
(when (or local-host local-port)
(sb-bsd-sockets:socket-bind socket
- (host-to-vector-quad
- (or local-host *wildcard-host*))
+ (host-to-vector-quad (or
local-host *wildcard-host*))
(or local-port *auto-port*)))
(setf usocket (make-datagram-socket socket))
(when (and host port)
More information about the usocket-devel
mailing list