[usocket-cvs] r583 - usocket/branches/0.5.x/backend

Chun Tian (binghe) ctian at common-lisp.net
Sun Mar 20 13:44:17 UTC 2011


Author: ctian
Date: Sun Mar 20 09:44:17 2011
New Revision: 583

Log:
Bugfix: UDP flag "connected-p" never been set in SOCKET-CONNECT (LW, CCL and SCL).

Modified:
   usocket/branches/0.5.x/backend/lispworks.lisp
   usocket/branches/0.5.x/backend/openmcl.lisp
   usocket/branches/0.5.x/backend/scl.lisp

Modified: usocket/branches/0.5.x/backend/lispworks.lisp
==============================================================================
--- usocket/branches/0.5.x/backend/lispworks.lisp	(original)
+++ usocket/branches/0.5.x/backend/lispworks.lisp	Sun Mar 20 09:44:17 2011
@@ -305,7 +305,7 @@
 			 (open-udp-socket :local-address (and local-host (host-to-hostname local-host))
 					  :local-port local-port
                                           :read-timeout timeout))
-		     :connected-p t)))
+		     :connected-p (and host port t))))
        (hcl:flag-special-free-action usocket)
        usocket))))
 

Modified: usocket/branches/0.5.x/backend/openmcl.lisp
==============================================================================
--- usocket/branches/0.5.x/backend/openmcl.lisp	(original)
+++ usocket/branches/0.5.x/backend/openmcl.lisp	Sun Mar 20 09:44:17 2011
@@ -100,17 +100,18 @@
 	 (openmcl-socket:socket-connect mcl-sock)
 	 (make-stream-socket :stream mcl-sock :socket mcl-sock)))
       (:datagram
-       (let ((mcl-sock
-	      (openmcl-socket:make-socket :address-family :internet
-					  :type :datagram
-					  :local-host (when local-host (host-to-hostname local-host))
-					  :local-port local-port
-					  :format :binary)))
+       (let* ((mcl-sock
+               (openmcl-socket:make-socket :address-family :internet
+                                           :type :datagram
+                                           :local-host (when local-host (host-to-hostname local-host))
+                                           :local-port local-port
+                                           :format :binary))
+              (usocket (make-datagram-socket mcl-sock)))
 	 (when (and host port)
-	   (ccl::inet-connect (ccl::socket-device mcl-sock)
-			      (ccl::host-as-inet-host host)
-			      (ccl::port-as-inet-port port "udp")))
-	 (make-datagram-socket mcl-sock))))))
+           (ccl::inet-connect (ccl::socket-device mcl-sock)
+                              (ccl::host-as-inet-host host)
+                              (ccl::port-as-inet-port port "udp"))
+           (setf (connected-p usocket) t)))))))
 
 (defun socket-listen (host port
                            &key reuseaddress

Modified: usocket/branches/0.5.x/backend/scl.lisp
==============================================================================
--- usocket/branches/0.5.x/backend/scl.lisp	(original)
+++ usocket/branches/0.5.x/backend/scl.lisp	Sun Mar 20 09:44:17 2011
@@ -82,7 +82,7 @@
 							     (host-to-hbo local-host)))))
 		     (with-mapped-conditions ()
 		       (ext:create-inet-socket protocol)))))
-       (let ((usocket (make-datagram-socket socket)))
+       (let ((usocket (make-datagram-socket socket :connected-p (and host port t))))
 	 (ext:finalize usocket #'(lambda ()
 				   (when (%open-p usocket)
 				     (ext:close-socket socket))))




More information about the usocket-cvs mailing list