From be22beac4a99bf6f426c34fbd29b5820e7c57e40 Mon Sep 17 00:00:00 2001 From: "Kevin M. Rosenberg" Date: Tue, 8 Jul 2003 12:10:16 +0000 Subject: [PATCH] r5253: *** empty log message *** --- compat.lisp | 39 ++++++++++++++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 5 deletions(-) diff --git a/compat.lisp b/compat.lisp index e715121..e76b7ff 100644 --- a/compat.lisp +++ b/compat.lisp @@ -1,5 +1,5 @@ ;;; -*- Syntax: Ansi-Common-Lisp; Base: 10; Mode: lisp; Package: clit -*- -;;; $Id: compat.lisp,v 1.2 2003/07/08 08:34:22 kevin Exp $ +;;; $Id: compat.lisp,v 1.3 2003/07/08 12:10:16 kevin Exp $ (in-package #:modlisp) @@ -43,7 +43,33 @@ #+lispworks (progn - (defclass socket () + +(define-condition lw-stream-error (error) + ((stream :initarg :stream + :reader stream-error-stream) + (action :initarg :action + :reader stream-error-action) + (code :initarg :code + :reader stream-error-code) + (identifier :initarg :identifier + :reader stream-error-identifier)) + (:report (lambda (condition stream) + (format stream "A stream error occured (action=~A identifier=~A code=~A stream=~S)." + (stream-error-action condition) + (stream-error-identifier condition) + (stream-error-code condition) + (stream-error-stream condition))))) + +(define-condition socket-error (lw-stream-error) + () + (:report (lambda (condition stream) + (format stream "A socket error occured (action=~A identifier=~A code=~A stream=~S)." + (stream-error-action condition) + (stream-error-identifier condition) + (stream-error-code condition) + (stream-error-stream condition))))) + +(defclass socket () ((passive-socket :type fixnum :initarg :passive-socket :reader socket-os-fd))) @@ -168,7 +194,8 @@ setsockopt SO_REUSEADDR if :reuse is not nil" (make-instance 'passive-socket :port port :passive-socket (%new-passive-socket port) - :element-type format)) + :element-type (case format + (:text 'base-char)))) ) (defun make-fd-stream (socket &key input output element-type) @@ -202,10 +229,12 @@ setsockopt SO_REUSEADDR if :reuse is not nil" #+clisp (ext:socket-accept listener) #+lispworks - (when (stream-input-available listener) + (progn + (loop while (not (stream-input-available listener)) + do (sleep 1)) (make-instance 'bidirectional-binary-socket-stream :socket (comm::get-fd-from-socket - (socket-os-fd passive-socket)) + (socket-os-fd listener)) :direction :io :element-type (element-type listener))) -- 2.34.1