#37 SBCL-patch for acl-compat.socket:local-host

open
nobody
None
5
2012-09-14
2010-07-19
Anonymous
No

(in-package :acl-compat.socket)

+sbcl

(defun local-host (thing)
(typecase thing
(chunked-stream (let ((socket (getf (stream-plist thing) :socket)))
(if socket (vector-to-ipaddr (socket-name socket))
(progn (warn "Socket not in plist of ~S -- could not get local host" thing)
0))))
(server-socket (vector-to-ipaddr #(127 0 0 1)))
;; the following line is inserted, because it is called in
;; net.post-office:connect-to-mail-server on a fd-stream
;; (because make-socket returns a stream in SBCL)
#+sbcl
(sb-sys:fd-stream (vector-to-ipaddr #(127 0 0 1)))
(t (progn (warn "Could not get local host for ~S" thing)
0))))

Discussion