Author: ehuelsmann
Date: Sat Feb 4 06:24:14 2006
New Revision: 37
Modified:
usocket/trunk/README
usocket/trunk/backend/allegro.lisp
usocket/trunk/backend/clisp.lisp
usocket/trunk/backend/sbcl.lisp
usocket/trunk/condition.lisp
usocket/trunk/doc/backends.txt
Log:
Remove usocket- prefix from (most) errors.
Also eliminate clisp error- and condition-map remapping.
Modified: usocket/trunk/README
==============================================================================
--- usocket/trunk/README (original)
+++ usocket/trunk/README Sat Feb 4 06:24:14 2006
@@ -20,30 +20,30 @@
Errors:
- - usocket-address-in-use-error
- - usocket-address-not-available-error
- - usocket-bad-file-descriptor-error
- - usocket-connection-refused-error
- - usocket-connection-aborted-error * TODO
- - usocket-connection-reset-error * TODO
- - usocket-invalid-argument-error
- - usocket-no-buffers-error
- - usocket-operation-not-supported-error
- - usocket-operation-not-permitted-error
- - usocket-protocol-not-supported-error
- - usocket-socket-type-not-supported-error
- - usocket-network-unreachable-error
- - usocket-network-down-error
- - usocket-network-reset-error
- - usocket-host-down-error
- - usocket-host-unreachable-error
- - usocket-shutdown-error
- - usocket-timeout-error
- - usocket-unkown-error
+ - address-in-use-error
+ - address-not-available-error
+ - bad-file-descriptor-error
+ - connection-refused-error
+ - connection-aborted-error * TODO
+ - connection-reset-error * TODO
+ - invalid-argument-error
+ - no-buffers-error
+ - operation-not-supported-error
+ - operation-not-permitted-error
+ - protocol-not-supported-error
+ - socket-type-not-supported-error
+ - network-unreachable-error
+ - network-down-error
+ - network-reset-error
+ - host-down-error
+ - host-unreachable-error
+ - shutdown-error
+ - timeout-error
+ - unkown-error
Non-fatal conditions:
- - usocket-interrupted-condition
- - usocket-unkown-condition
+ - interrupted-condition
+ - unkown-condition
TODO:
Modified: usocket/trunk/backend/allegro.lisp
==============================================================================
--- usocket/trunk/backend/allegro.lisp (original)
+++ usocket/trunk/backend/allegro.lisp Sat Feb 4 06:24:14 2006
@@ -10,8 +10,8 @@
(:address-not-available . usocket-address-not-available-error)
(:network-down . usocket-network-down-error)
(:network-reset . usocket-network-reset-error)
-;; (:connection-aborted . ) FIXME: take these 2 errors in the supported list
-;; (:connection-reset . )
+ (:connection-aborted . usocket-connection-aborted-error)
+ (:connection-reset . usocket-connection-reset-error)
(:no-buffer-space . usocket-no-buffers-error)
(:shutdown . usocket-shutdown-error)
(:connection-timed-out . usocket-timeout-error)
Modified: usocket/trunk/backend/clisp.lisp
==============================================================================
--- usocket/trunk/backend/clisp.lisp (original)
+++ usocket/trunk/backend/clisp.lisp Sat Feb 4 06:24:14 2006
@@ -5,33 +5,36 @@
(in-package :usocket)
-(defun remap-maybe-for-win32 (z &optional errorp)
+
+#+win32
+(defun remap-maybe-for-win32 (z)
(mapcar #'(lambda (x)
- (list #-win32 (car x)
- #+win32 (mapcar #'(lambda (y)
- (+ 10000 y))
- (car x))
- (cdr x)
- errorp))
+ (cons (mapcar #'(lambda (y)
+ (+ 10000 y))
+ (car x))
+ (cdr x)))
z))
(defparameter +clisp-error-map+
- (append (remap-maybe-for-win32 +unix-errno-condition-map+)
- (remap-maybe-for-win32 +unix-errno-error-map+ t)))
+ #+win32
+ (append (remap-for-win32 +unix-errno-condition-map+)
+ (remap-for-win32 +unix-errno-error-map+))
+ #-win32
+ (append +unix-errno-condition-map+
+ +unix-errno-error-map+))
(defun handle-condition (condition &optional (socket nil))
"Dispatch correct usocket condition."
(typecase condition
(system::simple-os-error
- (destructuring-bind
- (&optional usock-err errorp)
- (cdr (assoc (car (simple-condition-format-arguments condition))
- +clisp-error-map+ :test #'member))
+ (let ((usock-err
+ (cdr (assoc (car (simple-condition-format-arguments condition))
+ +clisp-error-map+ :test member))))
(if usock-err
- (if errorp
+ (if (subtypep usock-err 'error)
(error usock-err :socket socket)
(signal usock-err :socket socket))
- (error 'usocket-unknown-error
+ (error 'unknown-error
:socket socket
:real-error condition))))))
Modified: usocket/trunk/backend/sbcl.lisp
==============================================================================
--- usocket/trunk/backend/sbcl.lisp (original)
+++ usocket/trunk/backend/sbcl.lisp Sat Feb 4 06:24:14 2006
@@ -9,27 +9,34 @@
(map-errno-error (sb-bsd-sockets::socket-error-errno sock-err)))
(defparameter +sbcl-condition-map+
- '((interrupted-error . usocket-interrupted-condition)))
+ '((interrupted-error . interrupted-condition)))
(defparameter +sbcl-error-map+
- `((sb-bsd-sockets:address-in-use-error . usocket-address-in-use-error)
- (sb-bsd-sockets::no-address-error . usocket-address-not-available-error)
- (sb-bsd-sockets:bad-file-descriptor-error . usocket-bad-file-descriptor-error)
- (sb-bsd-sockets:connection-refused-error . usocket-connection-refused-error)
- (sb-bsd-sockets:invalid-argument-error . usocket-invalid-argument-error)
- (no-buffers-error . usocket-no-buffers-error)
- (operation-not-supported-error . usocket-operation-not-supported-error)
- (operation-not-permitted-error . usocket-operation-not-permitted-error)
- (protocol-not-supported-error . usocket-protocol-not-supported-error)
- (socket-type-not-supported-error . usocket-socket-type-not-supported-error)
- (network-unreachable-error . usocket-network-unreachable-error)
- ;; (... . usocket-network-down-error)
- (no-recovery-error . usocket-network-reset-error)
- ;; (... . usocket-host-down-error)
- ;; (... . usocket-host-unreachable-error)
- ;; (... . usocket-shutdown-error)
- (operation-timeout-error . usocket-timeout-error)
- (sb-bsd-sockets:socket-error . ,#'map-socket-error)))
+ ;;### FIXME: sb-bsd-sockets also has a name-service-error
+ ;; which is signalled when a hostname can't be resolved...
+ ;; what to do with that?
+ `((sb-bsd-sockets:address-in-use-error . address-in-use-error)
+ (sb-bsd-sockets::no-address-error . address-not-available-error)
+ (sb-bsd-sockets:bad-file-descriptor-error . bad-file-descriptor-error)
+ (sb-bsd-sockets:connection-refused-error . connection-refused-error)
+ (sb-bsd-sockets:invalid-argument-error . invalid-argument-error)
+ (sb-bsd-sockets:no-buffers-error . no-buffers-error)
+ (sb-bsd-sockets:operation-not-supported-error . operation-not-supported-error)
+ (sb-bsd-sockets:operation-not-permitted-error . operation-not-permitted-error)
+ (sb-bsd-sockets:protocol-not-supported-error . protocol-not-supported-error)
+ (sb-bsd-sockets:socket-type-not-supported-error . socket-type-not-supported-error)
+ (sb-bsd-sockets:network-unreachable-error . network-unreachable-error)
+ ;; (... . network-down-error)
+ ;; (... . host-down-error)
+ ;; (... . host-unreachable-error)
+ ;; (... . shutdown-error)
+ (sb-bsd-sockets:operation-timeout-error . timeout-error)
+ (sb-bsd-sockets:socket-error . ,#'map-socket-error)
+ ;; Nameservice errors
+ (sb-bsd-sockets:no-recovery-error . network-reset-error)
+;; (sb-bsd-sockets:try-again-condition ...)
+;; (sb-bsd-sockets:host-not-found ...)
+ ))
(defun handle-condition (condition &optional (socket nil))
"Dispatch correct usocket condition."
@@ -41,7 +48,7 @@
usock-error)))
(if usock-error
(error usock-error :socket socket)
- (error 'usocket-unknown-error
+ (error 'unknown-error
:socket socket
:real-error condition))))
(condition (let* ((usock-cond (cdr (assoc (type-of condition)
@@ -51,7 +58,7 @@
usock-cond)))
(if usock-cond
(signal usock-cond :socket socket)
- (signal 'usocket-unkown-condition
+ (signal 'unkown-condition
:real-condition condition))))))
Modified: usocket/trunk/condition.lisp
==============================================================================
--- usocket/trunk/condition.lisp (original)
+++ usocket/trunk/condition.lisp Sat Feb 4 06:24:14 2006
@@ -42,10 +42,10 @@
;; Mass define and export our conditions
(define-usocket-condition-classes
- (usocket-interrupted-condition)
+ (interrupted-condition)
(usocket-condition))
-(define-condition usocket-unknown-condition (usocket-condition)
+(define-condition unknown-condition (usocket-condition)
((real-condition :initarg :real-condition
:accessor usocket-real-condition))
(:documentation ""))
@@ -53,26 +53,28 @@
;; Mass define and export our errors
(define-usocket-condition-classes
- (usocket-address-in-use-error
- usocket-address-not-available-error
- usocket-bad-file-descriptor-error
- usocket-connection-refused-error
- usocket-invalid-argument-error
- usocket-no-buffers-error
- usocket-operation-not-supported-error
- usocket-operation-not-permitted-error
- usocket-protocol-not-supported-error
- usocket-socket-type-not-supported-error
- usocket-network-unreachable-error
- usocket-network-down-error
- usocket-network-reset-error
- usocket-host-down-error
- usocket-host-unreachable-error
- usocket-shutdown-error
- usocket-timeout-error)
+ (address-in-use-error
+ address-not-available-error
+ bad-file-descriptor-error
+ connection-refused-error
+ connection-aborted-error
+ connection-reset-error
+ invalid-argument-error
+ no-buffers-error
+ operation-not-supported-error
+ operation-not-permitted-error
+ protocol-not-supported-error
+ socket-type-not-supported-error
+ network-unreachable-error
+ network-down-error
+ network-reset-error
+ host-down-error
+ host-unreachable-error
+ shutdown-error
+ timeout-error)
(usocket-error))
-(define-condition usocket-unknown-error (usocket-error)
+(define-condition unknown-error (usocket-error)
((real-error :initarg :real-error
:accessor usocket-real-error))
(:documentation ""))
@@ -84,9 +86,9 @@
(condition (condition) (handle-condition condition ,socket))))
(defparameter +unix-errno-condition-map+
- `(((11) . usocket-retry-condition) ;; EAGAIN
- ((35) . usocket-retry-condition) ;; EDEADLCK
- ((4) . usocket-interrupted-condition))) ;; EINTR
+ `(((11) . retry-condition) ;; EAGAIN
+ ((35) . retry-condition) ;; EDEADLCK
+ ((4) . interrupted-condition))) ;; EINTR
(defparameter +unix-errno-error-map+
;;### the first column is for non-(linux or srv4) systems
@@ -96,24 +98,26 @@
;; (at least in clisp and sbcl; I know about cmucl...)
;; The table below works under the assumption we'll *only* see
;; socket associated errors...
- `(((48 98) . usocket-address-in-use-error)
- ((49 99) . usocket-address-not-available-error)
- ((9) . usocket-bad-file-descriptor-error)
- ((61 111) . usocket-connection-refused-error)
- ((22) . usocket-invalid-argument-error)
- ((55 105) . usocket-no-buffers-error)
- ((12) . usocket-out-of-memory-error)
- ((45 95) . usocket-operation-not-supported-error)
- ((1) . usocket-operation-not-permitted-error)
- ((43 92) . usocket-protocol-not-supported-error)
- ((44 93) . usocket-socket-type-not-supported-error)
- ((51 102) . usocket-network-unreachable-error)
- ((50 100) . usocket-network-down-error)
- ((52 102) . usocket-network-reset-error)
- ((58 108) . usocket-already-shutdown-error)
- ((60 110) . usocket-connection-timeout-error)
- ((64 112) . usocket-host-down-error)
- ((65 113) . usocket-host-unreachable-error)))
+ `(((48 98) . address-in-use-error)
+ ((49 99) . address-not-available-error)
+ ((9) . bad-file-descriptor-error)
+ ((61 111) . connection-refused-error)
+ ((64 131) . connection-reset-error)
+ ((130) . connection-aborted-error)
+ ((22) . invalid-argument-error)
+ ((55 105) . no-buffers-error)
+ ((12) . out-of-memory-error)
+ ((45 95) . operation-not-supported-error)
+ ((1) . operation-not-permitted-error)
+ ((43 92) . protocol-not-supported-error)
+ ((44 93) . socket-type-not-supported-error)
+ ((51 102) . network-unreachable-error)
+ ((50 100) . network-down-error)
+ ((52 102) . network-reset-error)
+ ((58 108) . already-shutdown-error)
+ ((60 110) . connection-timeout-error)
+ ((64 112) . host-down-error)
+ ((65 113) . host-unreachable-error)))
Modified: usocket/trunk/doc/backends.txt
==============================================================================
--- usocket/trunk/doc/backends.txt (original)
+++ usocket/trunk/doc/backends.txt Sat Feb 4 06:24:14 2006
@@ -20,26 +20,26 @@
An error-handling function, resolving implementation specific errors
to this list of errors:
- - usocket-address-in-use-error
- - usocket-address-not-available-error
- - usocket-bad-file-descriptor-error
- - usocket-connection-refused-error
- - usocket-invalid-argument-error
- - usocket-no-buffers-error
- - usocket-operation-not-supported-error
- - usocket-operation-not-permitted-error
- - usocket-protocol-not-supported-error
- - usocket-socket-type-not-supported-error
- - usocket-network-unreachable-error
- - usocket-network-down-error
- - usocket-network-reset-error
- - usocket-host-down-error
- - usocket-host-unreachable-error
- - usocket-shutdown-error
- - usocket-timeout-error
- - usocket-unkown-error
+ - address-in-use-error
+ - address-not-available-error
+ - bad-file-descriptor-error
+ - connection-refused-error
+ - invalid-argument-error
+ - no-buffers-error
+ - operation-not-supported-error
+ - operation-not-permitted-error
+ - protocol-not-supported-error
+ - socket-type-not-supported-error
+ - network-unreachable-error
+ - network-down-error
+ - network-reset-error
+ - host-down-error
+ - host-unreachable-error
+ - shutdown-error
+ - timeout-error
+ - unkown-error
and these conditions:
- - usocket-interrupted-condition
- - usocket-unkown-condition
+ - interrupted-condition
+ - unkown-condition