anchor.diff:    ((ctx :accessor as-ssl-ctx :initarg :ctx :initform nil)
      (bio-read :accessor as-ssl-bio-read :initarg :bio-read :initform nil)
      (bio-write :accessor as-ssl-bio-write :initarg :bio-write :initform nil)
  -   (ssl :accessor as-ssl-ssl :initarg :ssl :initform nil)))
  +   (ssl :accessor as-ssl-ssl :initarg :ssl :initform nil)
  +   (freed :accessor as-ssl-freed :initform nil)))
   
   (defclass ssl-socket (socket)
  -  ((as-ssl :accessor socket-ssl-as-ssl :initarg :as-ssl :initform nil))
  +  ((as-ssl :accessor socket-as-ssl :initarg :as-ssl :initform nil)
  +   (ssl-closing :accessor socket-ssl-closing :initform nil))
     (:documentation "Wraps a libevent SSL socket."))
   
   (defclass tcp-ssl-server (tcp-server)
  
positive.code:   ;; free the SSL ctx (if it exists)
    (close-ssl (tcp-server-ssl-as-ssl tcp-server)))
  
  (defun write-to-ssl (as-ssl 
  (defmethod write-socket-data ((socket ssl-socket) data &key read-cb write-cb event-cb force)
    (let ((uvstream (socket-c socket))
          (do-send (lambda ()
                     (write-to-ssl (socket-ssl-as-ssl socket) data))))
      (if (or read-cb write-cb event-cb)
          ;; we're specifying callbacks. since we're most likely calling this from
          ;; inside a socket callback and we don't necessarily want to overwrite
  
negative.code: 
  (defun close-ssl (as-ssl)
    "Close up a cl-async SSL object."
    (when (as-ssl-freed as-ssl)
      (return-from close-ssl))
    (let* ((ctx (as-ssl-ctx as-ssl))
           (ssl (as-ssl-ssl as-ssl)))
      (and (cffi:pointerp ctx) (ssl-ctx-free ctx))
      (and (cffi:pointerp ssl) (ssl-free ssl))
      (setf (as-ssl-freed as-ssl) t)))
    
  (defmethod close-socket ((socket ssl-socket) &key force)
    (declare (ignore force))
    (let* ((as-ssl (socket-as-ssl socket))
           (res (ssl-shutdown (as-ssl-ssl as-ssl))))
      (call-next-method)
      (close-ssl as-ssl)))
  
  (defmethod close-tcp-server ((tcp-server tcp-ssl-server))
    ;; shut down the listener before freeing the SSL handles
  