[usocket-cvs] r187 - in usocket/trunk: . backend
ehuelsmann at common-lisp.net
ehuelsmann at common-lisp.net
Sat Jan 20 12:45:21 UTC 2007
Author: ehuelsmann
Date: Sat Jan 20 07:45:20 2007
New Revision: 187
Modified:
usocket/trunk/README
usocket/trunk/backend/allegro.lisp
usocket/trunk/backend/armedbear.lisp
usocket/trunk/backend/clisp.lisp
usocket/trunk/backend/lispworks.lisp
usocket/trunk/backend/openmcl.lisp
usocket/trunk/backend/sbcl.lisp
usocket/trunk/backend/scl.lisp
usocket/trunk/usocket.lisp
Log:
Add last-minute :element-type specification for trivial-sockets compatibility.
Modified: usocket/trunk/README
==============================================================================
--- usocket/trunk/README (original)
+++ usocket/trunk/README Sat Jan 20 07:45:20 2007
@@ -70,7 +70,7 @@
socket-listen host port &key reuseaddress backlog element-type
where `host' has the same definition as above
- socket-accept (method) [ to create an active/connected socket ]
- socket-accept socket
+ socket-accept socket &key element-type
returns (server side) a connected socket derived from a
listening/passive socket.
- socket-close (method)
Modified: usocket/trunk/backend/allegro.lisp
==============================================================================
--- usocket/trunk/backend/allegro.lisp (original)
+++ usocket/trunk/backend/allegro.lisp Sat Jan 20 07:45:20 2007
@@ -74,7 +74,8 @@
(list :local-host host)))))))
(make-stream-server-socket sock :element-type element-type)))
-(defmethod socket-accept ((socket stream-server-usocket))
+(defmethod socket-accept ((socket stream-server-usocket) &key element-type)
+ (declare (ignore element-type)) ;; allegro streams are multivalent
(let ((stream-sock (socket:accept-connection (socket socket))))
(make-stream-socket :socket stream-sock :stream stream-sock)))
Modified: usocket/trunk/backend/armedbear.lisp
==============================================================================
--- usocket/trunk/backend/armedbear.lisp (original)
+++ usocket/trunk/backend/armedbear.lisp Sat Jan 20 07:45:20 2007
@@ -48,12 +48,13 @@
sock-addr backlog)
(make-stream-server-socket sock :element-type element-type)))
-(defmethod socket-accept ((socket stream-server-usocket))
+(defmethod socket-accept ((socket stream-server-usocket) &key element-type)
(let* ((jsock (socket socket))
(jacc-sock (jmethod-call jsock ("accept")))
(jacc-stream
(ext:get-socket-stream jacc-sock
- :element-type (element-type socket))))
+ :element-type (or element-type
+ (element-type socket)))))
(make-stream-socket :socket jacc-sock
:stream jacc-stream)))
Modified: usocket/trunk/backend/clisp.lisp
==============================================================================
--- usocket/trunk/backend/clisp.lisp (original)
+++ usocket/trunk/backend/clisp.lisp Sat Jan 20 07:45:20 2007
@@ -62,9 +62,11 @@
(list :interface host))))))
(make-stream-server-socket sock :element-type element-type)))
-(defmethod socket-accept ((socket stream-server-usocket))
- (let ((stream (socket:socket-accept (socket socket)
- :element-type (element-type socket))))
+(defmethod socket-accept ((socket stream-server-usocket) &key element-type)
+ (let ((stream
+ (socket:socket-accept (socket socket)
+ :element-type (or element-type
+ (element-type socket)))))
(make-stream-socket :socket stream
:stream stream)))
Modified: usocket/trunk/backend/lispworks.lisp
==============================================================================
--- usocket/trunk/backend/lispworks.lisp (original)
+++ usocket/trunk/backend/lispworks.lisp Sat Jan 20 07:45:20 2007
@@ -67,12 +67,13 @@
#+lispworks4.1 (comm::create-tcp-socket-for-service port))))
(make-stream-server-socket sock :element-type element-type)))
-(defmethod socket-accept ((usocket stream-server-usocket))
+(defmethod socket-accept ((usocket stream-server-usocket) &key element-type)
(let* ((sock (comm::get-fd-from-socket (socket usocket)))
(stream (make-instance 'comm:socket-stream
:socket sock
:direction :io
- :element-type (element-type usocket))))
+ :element-type (or element-type
+ (element-type usocket)))))
(make-stream-socket :socket sock :stream stream)))
(defmethod socket-close ((usocket stream-usocket))
Modified: usocket/trunk/backend/openmcl.lisp
==============================================================================
--- usocket/trunk/backend/openmcl.lisp (original)
+++ usocket/trunk/backend/openmcl.lisp Sat Jan 20 07:45:20 2007
@@ -68,7 +68,8 @@
(list :local-host host))))))
(make-stream-server-socket sock :element-type element-type)))
-(defmethod socket-accept ((usocket stream-server-usocket))
+(defmethod socket-accept ((usocket stream-server-usocket) &key element-type)
+ (declare (ignore element-type)) ;; openmcl streams are bi/multivalent
(let ((sock (openmcl-socket:accept-connection (socket usocket))))
(make-stream-socket :socket sock :stream sock)))
Modified: usocket/trunk/backend/sbcl.lisp
==============================================================================
--- usocket/trunk/backend/sbcl.lisp (original)
+++ usocket/trunk/backend/sbcl.lisp Sat Jan 20 07:45:20 2007
@@ -94,12 +94,13 @@
(sb-bsd-sockets:socket-listen sock backlog)
(make-stream-server-socket sock :element-type element-type)))
-(defmethod socket-accept ((socket stream-server-usocket))
+(defmethod socket-accept ((socket stream-server-usocket) &key element-type)
(let ((sock (sb-bsd-sockets:socket-accept (socket socket))))
(make-stream-socket :socket sock
:stream (sb-bsd-sockets:socket-make-stream sock
:input t :output t :buffering :full
- :element-type (element-type socket)))))
+ :element-type (or element-type
+ (element-type socket))))))
(defmethod socket-close ((usocket usocket))
(with-mapped-conditions (usocket)
Modified: usocket/trunk/backend/scl.lisp
==============================================================================
--- usocket/trunk/backend/scl.lisp (original)
+++ usocket/trunk/backend/scl.lisp Sat Jan 20 07:45:20 2007
@@ -54,10 +54,11 @@
:backlog backlog)))
(make-stream-server-socket server-sock :element-type element-type)))
-(defmethod socket-accept ((usocket stream-server-usocket))
+(defmethod socket-accept ((usocket stream-server-usocket) &key element-type)
(let* ((sock (ext:accept-tcp-connection (socket usocket)))
(stream (sys:make-fd-stream sock :input t :output t
- :element-type (element-type usocket)
+ :element-type (or element-type
+ (element-type usocket))
:buffering :full)))
(make-stream-socket :socket sock :stream stream)))
Modified: usocket/trunk/usocket.lisp
==============================================================================
--- usocket/trunk/usocket.lisp (original)
+++ usocket/trunk/usocket.lisp Sat Jan 20 07:45:20 2007
@@ -271,7 +271,9 @@
;; Documentation for the function
;;
-;; (defun SOCKET-ACCEPT (socket &key element-type
-;; buffered timeout) ..)
+;; (defun SOCKET-ACCEPT (socket &key element-type)
(setf (documentation 'socket-accept 'function)
- "")
+ "Accepts a connection from `socket', returning a `stream-socket'.
+
+The stream associated with the socket returned has `element-type' when
+explicitly specified, or the element-type passed to `socket-listen' otherwise.")
More information about the usocket-cvs
mailing list