tags:

views:

243

answers:

1

New version of SBCL 1.0.28 running on debian breaks AllegroServe 1.2.47 on incoming connection with following error:

aserve-accept-6: 05/26/09 - 21:11:01 - accept: error 0 on accept invalid
                          keyword argument: :AUTO-CLOSE (valid keys are
                          :INPUT, :OUTPUT, :ELEMENT-TYPE, :EXTERNAL-FORMAT,
                          :BUFFERING, :TIMEOUT).

Portable AllegroServe page does make a mention of this problem. However, no google searches turn up anything of use for this problem.

Any ideas as to how to move forward with this problem, or alternatively, links pointing to places where this has been dealt with?

+2  A: 

After some mucking around, I've come up with the following solution:

In my source files, after I declare my package, compile/load the appropriate modules but before I declare anything in my package, I added the following code:

(defmethod sb-bsd-sockets:socket-make-stream ((socket sb-bsd-sockets:socket)
                               &key input output
                               (element-type 'character)
                               (buffering :full)
                               (external-format :default)
                               timeout
                 (auto-close t))
  "Default method for SOCKET objects.  An ELEMENT-TYPE of :DEFAULT
will construct a bivalent stream.  Acceptable values for BUFFERING
are :FULL, :LINE and :NONE.  Streams will have no TIMEOUT
by default.
  The stream for SOCKET will be cached, and a second invocation of this
method will return the same stream.  This may lead to oddities if this
function is invoked with inconsistent arguments \(e.g., one might request
an input stream and get an output stream in response\)."
  (let ((stream
         (and (slot-boundp socket 'stream) (slot-value socket 'stream))))
    (unless stream
      (setf stream (sb-sys:make-fd-stream
                    (sb-bsd-sockets:socket-file-descriptor socket)
                    :name "a socket"
                    :dual-channel-p t
                    :input input
                    :output output
                    :element-type element-type
                    :buffering buffering
                    :external-format external-format
                    :timeout timeout
         :auto-close auto-close)))
      (setf (slot-value socket 'stream) stream)
    (sb-ext:cancel-finalization socket)
    stream))

(It's basically a lift from what is in the sb-bsd-sockets/socket.lisp with the auto-close key added to the argument list)

This way I avoid modifying or patching system files, and basically hook into the sb-bsd-sockets package directly.

So far, it seems to be working as it should. Basic testing via successive calls to (room) shows me that there's no obvious memory leaks, and the performance is as expected.

Please feel free to comment on this kludge, and if you think it might affect the stability of my system in unexpected ways.

memet