Author: ctian Date: Fri Apr 1 04:45:48 2011 New Revision: 629
Log: [CLISP] SOCKET-RECEIVE (RAWSOCK version) returns reduced buffer when calling with a NIL buffer argument.
Modified: usocket/branches/0.5.x/backend/clisp.lisp
Modified: usocket/branches/0.5.x/backend/clisp.lisp ============================================================================== --- usocket/branches/0.5.x/backend/clisp.lisp (original) +++ usocket/branches/0.5.x/backend/clisp.lisp Fri Apr 1 04:45:48 2011 @@ -237,15 +237,19 @@ (sockaddr (rawsock:make-sockaddr :inet)) (real-length (or length +max-datagram-packet-size+)) (real-buffer (or buffer - (make-array real-length :element-type '(unsigned-byte 8)))) - (rv (rawsock:recvfrom sock real-buffer sockaddr + (make-array real-length + :element-type '(unsigned-byte 8))))) + (let ((rv (rawsock:recvfrom sock real-buffer sockaddr :start 0 :end real-length)) - (host 0) (port 0)) - (unless (connected-p socket) - (let ((data (rawsock:sockaddr-data sockaddr))) - (setq host (ip-from-octet-buffer data :start 4) - port (port-from-octet-buffer data :start 2)))) - (values real-buffer rv host port))) + (host 0) (port 0)) + (unless (connected-p socket) + (let ((data (rawsock:sockaddr-data sockaddr))) + (setq host (ip-from-octet-buffer data :start 4) + port (port-from-octet-buffer data :start 2)))) + (values (if buffer real-buffer (subseq real-buffer 0 rv)) + rv + host + port))))
(defmethod socket-send ((socket datagram-usocket) buffer length &key host port) "Returns the number of octets sent."