Changes that bring CLASH up to extended HTTP/1.0 support:
Made connection an abstract base class from which individual drivers deriver their specific connection classes (like it was intended in the first place). Added generic functions to get the address and hostname of the client.
This commit is contained in:
@ -10,7 +10,12 @@
|
||||
|
||||
;;;; %File Description:
|
||||
;;;;
|
||||
;;;;
|
||||
;;;; This file defines the abstract base class of connection classes.
|
||||
;;;; A connection keeps all the state that is related to a network
|
||||
;;;; connection. The implementation-dependent drivers create an
|
||||
;;;; instance of an implementation-dependent subclass of this for each
|
||||
;;;; connection they receive and pass it to the responsible server
|
||||
;;;; object.
|
||||
;;;;
|
||||
|
||||
(defconstant +connection-states+
|
||||
@ -24,20 +29,11 @@
|
||||
|
||||
(defgeneric connection-stream (connection))
|
||||
|
||||
(defgeneric connection-address (connection))
|
||||
|
||||
(defgeneric connection-hostname (connection))
|
||||
|
||||
(defgeneric close-connection (connection))
|
||||
|
||||
(defmethod close-connection :after ((connection connection))
|
||||
(setf (connection-state connection) :closed))
|
||||
|
||||
(defclass simple-connection (connection)
|
||||
((stream :initarg :stream :reader connection-stream)))
|
||||
|
||||
(defmethod close-connection ((connection simple-connection))
|
||||
(handler-case
|
||||
(close (connection-stream connection))
|
||||
(error (condition)
|
||||
#-CLASH-DEBUG nil
|
||||
#+CLASH-DEBUG
|
||||
(format t "~&;;; At ~D Error closing connection ~A:~%;;; ~A~&"
|
||||
(get-internal-real-time)
|
||||
connection condition))))
|
||||
|
||||
Reference in New Issue
Block a user