2009-05-29 19 views
2

SBCL 1.0.28新版本Debian的運行打破AllegroServe 1.2.47與以下錯誤傳入的連接:AllegroServe上SBCL 1.0.28用`接受無效的關鍵字參數失敗:AUTO-CLOSE`

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).

便攜式AllegroServe頁面確實提到了這個問題。但是,沒有谷歌搜索出現這個問題的任何用途。

有關如何解決這個問題的任何想法,或者指向已被處理的地方的鏈接?

回答

2

經過一番擺弄周圍,我想出了以下解決方案:

源文件後,我宣佈我的包,編譯/加載相應的模塊,但在此之前我在包聲明什麼,我添加以下代碼:

(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)) 

(這基本上是從什麼是在sb-bsd-sockets/socket.lisp與添加到參數列表中的auto-close鍵電梯)

ŧ他的方式是避免修改或修補系統文件,並直接掛接到sb-bsd-sockets包中。

到目前爲止,它似乎正在工作,因爲它應該。通過連續調用(room)進行的基本測試表明,沒有明顯的內存泄漏,性能如預期。

請隨時評論此kludge,如果您認爲這可能會以意想不到的方式影響系統的穩定性。

相關問題