From 8dc6ce7df6c1eaec46e95edf3fecec421b6ac4d4 Mon Sep 17 00:00:00 2001 From: Stelian Ionescu Date: Fri, 21 Mar 2008 00:44:32 +0100 Subject: [PATCH] Add keyword arguments INPUT-BUFFER-SIZE and OUTPUT-BUFFER-SIZE to MAKE-SOCKET-STREAM. Signed-off-by: Stelian Ionescu --- net.sockets/make-socket.lisp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/net.sockets/make-socket.lisp b/net.sockets/make-socket.lisp index f4afc4b..1e8be93 100644 --- a/net.sockets/make-socket.lisp +++ b/net.sockets/make-socket.lisp @@ -310,17 +310,21 @@ is automatically closed upon exit." (%getsockname fd ss size) (foreign-slot-value ss 'sockaddr-storage 'family)))) -(defun make-socket-stream (fd &key (external-format :default) (errorp t)) +(defun make-socket-stream (fd &key (external-format :default) (errorp t) + input-buffer-size output-buffer-size) "Creates an active stream socket instance of the appropriate subclass of SOCKET using `FD'. -The address family of the sockets is automatically discovered using OS functions. If `FD' is -an invalid socket descriptor and `ERRORP' is not NIL a condition subtype of POSIX-ERROR +The address family of the sockets is automatically discovered using OS functions. Buffer sizes +for the new socket can also be specified using `INPUT-BUFFER-SIZE' and `OUTPUT-BUFFER-SIZE'. +If `FD' is an invalid socket descriptor and `ERRORP' is not NIL a condition subtype of POSIX-ERROR is signaled, otherwise two values are returned: NIL and the specific condition object." (flet ((%make-socket-stream () (let ((family (switch ((get-address-family fd) :test #'=) (af-inet :ipv4) (af-inet6 :ipv6) (af-local :local)))) - (create-socket family :stream :active external-format :fd fd)))) + (create-socket family :stream :active external-format :fd fd + :input-buffer-size input-buffer-size + :output-buffer-size output-buffer-size)))) (if errorp (%make-socket-stream) (ignore-some-conditions (posix-error) -- 2.11.4.GIT