Permalink
Browse files

Clean clack-handler-toot up.

  • Loading branch information...
1 parent cbf284a commit 97f8a59ade03edaf720bf041adefc2bf499d050a @fukamachi committed Mar 25, 2015
Showing with 12 additions and 23 deletions.
  1. +5 −4 clack-handler-toot.asd
  2. +7 −19 src/handler/toot.lisp
@@ -22,10 +22,11 @@
:version "0.2.0"
:author "Eitaro Fukamachi"
:license "LLGPL"
- :depends-on (:cl-syntax
- :cl-syntax-annot
- :toot
+ :depends-on (:toot
+ :flexi-streams
+ :bordeaux-threads
+ :cl-ppcre
:split-sequence
- :cl-ppcre)
+ :alexandria)
:components ((:file "src/handler/toot"))
:description "Clack handler for Toot.")
View
@@ -1,11 +1,3 @@
-#|
- This file is a part of Clack package.
- URL: http://github.com/fukamachi/clack
- Copyright (c) 2011 Eitaro Fukamachi <e.arrows@gmail.com>
-
- Clack is freely distributable under the LLGPL License.
-|#
-
(in-package :cl-user)
(defpackage clack.handler.toot
(:use :cl
@@ -17,16 +9,15 @@
:shutdown-p
:listen-socket
:listen-backlog
+ :acceptor-process
:accept-connections)
(:import-from :flexi-streams
:octets-to-string)
(:import-from :alexandria
- :if-let))
+ :if-let)
+ (:export :run))
(in-package :clack.handler.toot)
-(cl-syntax:use-syntax :annot)
-
-@export
(defun run (app &key debug (port 5000)
ssl ssl-key-file ssl-cert-file ssl-key-password)
"Start Toot server."
@@ -59,13 +50,10 @@
:reuseaddress t
:backlog (listen-backlog acceptor)
:element-type '(unsigned-byte 8)))
- (accept-connections acceptor)))
-
-
-@export
-(defun stop (acceptor)
- "Stop Toot server."
- (toot:stop-acceptor acceptor))
+ (setf (acceptor-process (toot:taskmaster acceptor)) (bt:current-thread))
+ (unwind-protect
+ (accept-connections acceptor)
+ (toot:stop-acceptor acceptor))))
(defun handle-request (req &key ssl)
"Convert Request from server into a plist

0 comments on commit 97f8a59

Please sign in to comment.