[iolib-devel] PATCH: with-accept-connection and shutdown

Andrey Moskvitin archimag at gmail.com
Thu Apr 8 16:03:49 UTC 2010


Hi,

I found that with-accept-connection is no call shutdown on the socket,
but without this FIN will be sent to the client.

diff --git a/src/sockets/make-socket.lisp b/src/sockets/make-socket.lisp
index b87a214..e4e1d06 100644
--- a/src/sockets/make-socket.lisp
+++ b/src/sockets/make-socket.lisp
@@ -274,7 +274,10 @@ The socket is automatically closed upon exit."
 (defmacro with-accept-connection ((var passive-socket &rest args) &body
body)
   "Bind VAR to a socket created by passing PASSIVE-SOCKET and ARGS to
ACCEPT-CONNECTION and execute BODY as implicit PROGN.
 The socket is automatically closed upon exit."
-  `(with-open-stream (,var (accept-connection ,passive-socket , at args))
, at body))
+  `(with-open-stream (,var (accept-connection ,passive-socket , at args))
+     (unwind-protect
+          (progn , at body)
+       (shutdown ,var :write t :read t))))
 

 ;;; MAKE-SOCKET-FROM-FD


Andrey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/iolib-devel/attachments/20100408/2c9d94ee/attachment.html>


More information about the iolib-devel mailing list