[nio-cvs] r22 - in branches/home/psmith/restructure: . src src/io src/protocol/http

psmith at common-lisp.net psmith at common-lisp.net
Tue Jan 2 02:31:44 UTC 2007


Author: psmith
Date: Mon Jan  1 21:31:43 2007
New Revision: 22

Modified:
   branches/home/psmith/restructure/run.lisp
   branches/home/psmith/restructure/src/io/async-socket.lisp
   branches/home/psmith/restructure/src/io/nio-package.lisp
   branches/home/psmith/restructure/src/nio-server.lisp
   branches/home/psmith/restructure/src/protocol/http/nio-http-package.lisp
   branches/home/psmith/restructure/src/protocol/http/nio-http.asd
Log:
Parameterised protocol in nio-server

Modified: branches/home/psmith/restructure/run.lisp
==============================================================================
--- branches/home/psmith/restructure/run.lisp	(original)
+++ branches/home/psmith/restructure/run.lisp	Mon Jan  1 21:31:43 2007
@@ -1,5 +1,5 @@
-;;(push :nio-debug *features*)
+(push :nio-debug *features*)
 (require :asdf)
-(require :nio)
+(require :nio-http)
 (load "src/nio-server")
-(nio-server:start-server 'identity 'identity :host "127.0.0.1")
+(nio-server:start-server 'identity 'identity 'nio-http:http-state-machine :host "127.0.0.1")

Modified: branches/home/psmith/restructure/src/io/async-socket.lisp
==============================================================================
--- branches/home/psmith/restructure/src/io/async-socket.lisp	(original)
+++ branches/home/psmith/restructure/src/io/async-socket.lisp	Mon Jan  1 21:31:43 2007
@@ -146,7 +146,7 @@
    (remote-port :initform nil :initarg :remote-port)))
 
 
-(defun socket-accept (socket-fd)
+(defun socket-accept (socket-fd connection-type)
   "Accept connection from SOCKET-FD. Allocates and returns socket structure denoting the connection."
 
   (flet ((parse-inet6-addr (addr) 
@@ -170,7 +170,7 @@
 	;; accept connection
       (let* ((res (%accept socket-fd addr len)) 
 ;;	     (async-socket-fd (make-instance 'async-socket-fd :read-fd res :write-fd res)))
-	     (async-socket-fd (create-state-machine res res (make-instance 'async-socket-fd))))
+	     (async-socket-fd (create-state-machine connection-type res res (make-instance 'async-socket-fd))))
 
 	(unless (< res 0)
 	  (let ((len-value (mem-ref len :unsigned-int)))

Modified: branches/home/psmith/restructure/src/io/nio-package.lisp
==============================================================================
--- branches/home/psmith/restructure/src/io/nio-package.lisp	(original)
+++ branches/home/psmith/restructure/src/io/nio-package.lisp	Mon Jan  1 21:31:43 2007
@@ -34,7 +34,7 @@
 	     async-fd-read-fd async-fd-write-fd
 	     add-async-fd remove-async-fd
 	     set-accept-filter set-read-callback
-	     read-error
+	     read-error async-fd
 
 	     ;; async-socket.lisp
 	     make-inet-socket make-inet6-socket 

Modified: branches/home/psmith/restructure/src/nio-server.lisp
==============================================================================
--- branches/home/psmith/restructure/src/nio-server.lisp	(original)
+++ branches/home/psmith/restructure/src/nio-server.lisp	Mon Jan  1 21:31:43 2007
@@ -35,8 +35,11 @@
 ;;  (format t "Accepting connection from ~S:~D [~A].~%" host port proto)
   t)
 
-(defun start-server (connection-handler accept-filter &key 
-		     (protocol :inet) (port (+ (random 60000) 1024)) (host "localhost") 
+(defun start-server (connection-handler accept-filter connection-type 
+		     &key 
+		     (protocol :inet) 
+		     (port (+ (random 60000) 1024)) 
+		     (host "localhost") 
 		     (accept-connection #'trivial-accept))
 		     
 
@@ -72,12 +75,12 @@
     
 	(loop for unix-epoll-events = (poll-events event-queue) do
 
-	     (loop for (fd . event) in unix-epoll-events do		    
+	     (loop for (fd . event) in unix-epoll-events do	    
 		  (cond
 		  
 		    ;; new connection
 		    ((= fd sock)
-		     (let ((async-fd (socket-accept fd)))
+		     (let ((async-fd (socket-accept fd connection-type)))
 #+nio-debug		       (format t "start-server - New conn: ~A~%" async-fd)
 		       (cond
 			 ((null async-fd)

Modified: branches/home/psmith/restructure/src/protocol/http/nio-http-package.lisp
==============================================================================
--- branches/home/psmith/restructure/src/protocol/http/nio-http-package.lisp	(original)
+++ branches/home/psmith/restructure/src/protocol/http/nio-http-package.lisp	Mon Jan  1 21:31:43 2007
@@ -28,6 +28,6 @@
 	    
 	    (:export
 
-	     ;; http-response
-	     http-response
+	     ;; http-state-machine
+	     http-state-machine
 	     ))

Modified: branches/home/psmith/restructure/src/protocol/http/nio-http.asd
==============================================================================
--- branches/home/psmith/restructure/src/protocol/http/nio-http.asd	(original)
+++ branches/home/psmith/restructure/src/protocol/http/nio-http.asd	Mon Jan  1 21:31:43 2007
@@ -6,6 +6,7 @@
 
     :components ((:file "nio-http-package")
 		 (:file "http-response" :depends-on ("nio-http-package"))
+		 (:file "http-state-machine" :depends-on ("nio-http-package"))
 		 )
 
     :depends-on (:nio))
\ No newline at end of file



More information about the Nio-cvs mailing list