Skip to content

Commit

Permalink
Moved socket listening conditions from conditions.lisp to listen.lisp.
Browse files Browse the repository at this point in the history
  • Loading branch information
flambard committed Nov 10, 2012
1 parent 491200e commit 40dc597
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 12 deletions.
12 changes: 0 additions & 12 deletions src/conditions.lisp
Expand Up @@ -4,18 +4,6 @@
((comment :reader comment :initarg :comment)) ((comment :reader comment :initarg :comment))
(:documentation "The signaling function is not implemented yet.")) (:documentation "The signaling function is not implemented yet."))


(define-condition already-listening-on-socket (error)
((port :reader port :initarg :port))
(:documentation "This error is signaled when trying to listen on a socket when already listening on an existing socket."))

(define-condition not-listening-on-socket (error)
()
(:documentation "This condition is signaled when trying to accept connections with a listening socket."))

(defun start-listening-on-socket-restart (condition)
(declare (ignore condition))
(invoke-restart 'start-listening-on-socket))

(define-condition try-again () (define-condition try-again ()
((reason :reader reason :initarg :reason)) ((reason :reader reason :initarg :reason))
(:documentation "This condition is signaled when trying to connect to a remote node that is busy.")) (:documentation "This condition is signaled when trying to connect to a remote node that is busy."))
Expand Down
22 changes: 22 additions & 0 deletions src/listen.lisp
Expand Up @@ -3,6 +3,28 @@
(defvar *listening-socket* nil (defvar *listening-socket* nil
"The listening socket. NIL if not listening.") "The listening socket. NIL if not listening.")



;;;
;;; Conditions
;;;

(define-condition already-listening-on-socket (error)
((port :reader port :initarg :port))
(:documentation "This error is signaled when trying to listen on a socket when already listening on an existing socket."))

(define-condition not-listening-on-socket (error)
()
(:documentation "This condition is signaled when trying to accept connections with a listening socket."))

(defun start-listening-on-socket-restart (condition)
(declare (ignore condition))
(invoke-restart 'start-listening-on-socket))


;;;
;;; Socket listening functions
;;;

(defun listening-p () (defun listening-p ()
(not (null *listening-socket*))) (not (null *listening-socket*)))


Expand Down

0 comments on commit 40dc597

Please sign in to comment.