anchor.diff:    "Calls RUN-SERVER with given SERVER in separate thread.
   Return SERVER"
     (bt:make-thread
  -   (lambda ()      
  +   (lambda ()
         (run-server server))
      :name (server-name server))
     server)
   
  -
  -(defun stop-server (server)
  -  (log:info "Killing resources~%")
  +(defun careless-stop (server)
  +  (log:info "~a: Killing resources~%" (server-name server))
     (kill-all-server-resource-listeners server)
  -  (log:info "Stopping Server Thread~%")
  +  (log:info "~a: Stopping Server Thread~%" (server-name server))
  +  (funcall (execute-in-server-lambda server) (lambda () (sb-thread:abort-thread))))
  +
  +(defun stop-new-messages (server)
  +  (log:info "~a: Stop accepting new connections" (server-name server))
     (funcall (execute-in-server-lambda server) (lambda ()
  -                                                (sb-thread:abort-thread))))
  +                                                (setf (shutting-down-p server) t)
  +                                                (with-hash-table-iterator (next-client (server-clients server))
  +                                                  (loop
  +                                                    (multiple-value-bind (next? key client) (next-client)
  +                                                      (declare (ignorable key))
  +                                                      (unless next?
  +                                                        (return))
  +                                                            ;disable read
  +                                                      (setf (client-read-closed client) t)
  +                                                      (client-disable-handler client :read t)))))))
  +
  +(defun stop-exsiting-clients (server close-code)  
  +  (log:info "~a: Stop reading new incoming messages and enqueue close frame for all clients" (server-name server))
  +  (funcall (execute-in-server-lambda server) (lambda ()
  +                                                (with-hash-table-iterator (next-client (server-clients server))
  +                                                  (loop
  +                                                    (multiple-value-bind (next? key client) (next-client)
  +                                                      (declare (ignorable key))
  +                                                      (unless next?
  +                                                        (return))
  +                                                      ;;enqueue close
  +                                                      (write-to-client-close client :code close-code))))))
  +  (log:info "~a: Waiting until all clients closed" (server-name server))
  +  (loop
  +    (when (= 0 (hash-table-count (server-clients server)))
  +      (return))))
  +
  +(defun stop-server (server &key soft stop-new-messages-cb close-exsiting-clients-cb (close-code 3502))
  +  (if soft
  +      (progn
  +        (stop-new-messages server)
  +        (when stop-new-messages-cb
  +          (funcall stop-new-messages-cb server))
  +        (stop-exsiting-clients server close-code)
  +        (when close-exsiting-clients-cb
  +          (funcall close-exsiting-clients-cb server))
  +        (careless-stop server))
  +      (careless-stop server)))
  
positive.code: (defun make-listener-handler (server socket)
    (lambda (fd event exception)
       (declare (ignore fd event exception))
       (let* ((client-socket (accept-connection socket :wait t))
              (client (when client-socket
                        (make-instance (server-client-class server)
                                       :server server
                                       :%host (remote-host client-socket)
                                       :host (address-to-string
                                              (remote-host client-socket))
                                       :port (remote-port client-socket)
                                       :server-hook (slot-value server 'execute-in-server-lambda)
                                       :socket client-socket))))
         (when client
           (log:debug "got client connection from ~s ~s~%" (client-host client)
               (client-port client))
           (log:debug "client count = ~s/~s~%" (server-client-count server) *max-clients*)
           (cond
             ((and *max-clients* (> (server-client-count server) *max-clients*))
              ;; too many clients, send a server busy response and close connection
              (log:info "Too many clients ~s:~s, sending busy response" (server-client-count server) *max-clients*)
              (client-disconnect client :read t)
              (client-enqueue-write client *server-busy-message*)
              (client-enqueue-write client :close))
             (t
              ;; otherwise handle normally
              (setf (gethash client (server-clients server)) client)
              (add-reader-to-client client)))))))
  
  (defun run-server% (server)
    (let ((event-base (server-event-base server))
  
negative.code:             selves (just used as a set for now).")
     (resources :initform (make-hash-table :test 'equal) :reader server-resources
                :documentation "Collection of resource which handled by this server")
     (shutting-down-p :initform nil
                      :accessor shutting-down-p
                      :documentation "If t server enters shutting-down mode.
  Stop accepting new connections and all incoming messages. After last outgoing message is written server killed.")
     (control-fd :initform nil :reader server-control-fd)
     (control-mailbox :initform nil :reader server-control-mailbox)
     (execute-in-server-lambda :initform nil :reader execute-in-server-lambda
  