[usocket-devel] SBCL data flush problem

Chun Tian (binghe) binghe.lisp at gmail.com
Mon Aug 8 14:21:38 UTC 2011


Hi, Robert

Your proposal change has been merged into usocket 0.5.x and will be in next releases shortly.

Thanks again!

--binghe

在 2011-8-4,05:58, Robert Brown 写道:

> I use SBCL on Linux and have noticed a problem when writing
> lots of data to socket streams created with usocket.
> 
> In file backend/sbcl.lisp, the function socket-connect creates a
> stream as follows:
> 
> (setf (socket-stream usocket)
>       (sb-bsd-sockets:socket-make-stream socket
>                                                              :input t
>                                                              :output t
>                                                              :buffering :full
> 
> :element-type element-type))
> 
> If you look at the code for sb-bsd-sockets:socket-make-stream in
> sbcl/contrib/sb-bsd-sockets/sockets.lisp, you'll see that it specifies
> a default value of T for the keyword argument serve-events:
> 
>  (defmethod socket-make-stream ((socket socket)
>                               &key input output
>                               (element-type 'character)
>                               (buffering :full)
>                               (external-format :default)
>                               timeout
>                               auto-close
>                               (serve-events t))
> 
> This means that SBCL streams created by usocket have a true
> serve-events property.  When writing large amounts of data to several
> streams, the kernel will eventually stop accepting data from SBCL.
> When this happens, SBCL either waits for I/O to be possible on
> the file descriptor it's writing to or queues the data to be flushed later.
> Because usocket streams specify serve-events as true, SBCL
> always queues.  Instead, it should wait for I/O to be available and
> write the remaining data to the socket.  That's what serve-events
> equal to NIL gets you.
> 
> Usocket should add
> 
>   :serve-events NIL
> 
> to the call to socket-make-stream.
> 
> bob
> 
> _______________________________________________
> usocket-devel mailing list
> usocket-devel at common-lisp.net
> http://lists.common-lisp.net/cgi-bin/mailman/listinfo/usocket-devel





More information about the usocket-devel mailing list