[nio-cvs] r50 - in branches/home/psmith/restructure/src: io protocol/yarpc

psmith at common-lisp.net psmith at common-lisp.net
Mon Jan 22 05:54:44 UTC 2007


Author: psmith
Date: Mon Jan 22 00:54:43 2007
New Revision: 50

Modified:
   branches/home/psmith/restructure/src/io/async-fd.lisp
   branches/home/psmith/restructure/src/io/async-socket.lisp
   branches/home/psmith/restructure/src/io/nio-server.lisp
   branches/home/psmith/restructure/src/protocol/yarpc/yarpc-client-state-machine.lisp
   branches/home/psmith/restructure/src/protocol/yarpc/yarpc-packet-factory.lisp
   branches/home/psmith/restructure/src/protocol/yarpc/yarpc-state-machine.lisp
Log:
logging tidyup

Modified: branches/home/psmith/restructure/src/io/async-fd.lisp
==============================================================================
--- branches/home/psmith/restructure/src/io/async-fd.lisp	(original)
+++ branches/home/psmith/restructure/src/io/async-fd.lisp	Mon Jan 22 00:54:43 2007
@@ -87,7 +87,7 @@
 ;;SM factory 
 (defun create-state-machine(sm-type read-fd write-fd socket)
   (let ((sm (make-instance sm-type :read-fd read-fd :write-fd write-fd :socket socket)))
-    (format t "create-state-machine - Created ~S~%" sm)
+    (format-log t "async-fd:create-state-machine - Created ~S~%" sm)
     (nio-buffer:clear (foreign-read-buffer sm))
     (nio-buffer:clear (foreign-write-buffer sm))
     sm))

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 22 00:54:43 2007
@@ -137,7 +137,7 @@
     (init-inet-socket sa port addr)
 
     (let ((res (%connect socket-fd sa +sockaddr-in-len+)))
-      (format t "connect ~A ~A~%" res (get-errno))
+      (format-log t "async-socket:connect-inet-socket library connect call returned ~A, and errno ~A~%" res (get-errno))
       (if (= res -1)
       	  nil
       	  t))))

Modified: branches/home/psmith/restructure/src/io/nio-server.lisp
==============================================================================
--- branches/home/psmith/restructure/src/io/nio-server.lisp	(original)
+++ branches/home/psmith/restructure/src/io/nio-server.lisp	Mon Jan 22 00:54:43 2007
@@ -40,8 +40,8 @@
 ;loop over hashtable 
 (defun process-async-fds (client-hash)
   (maphash #'(lambda (k async-fd) 
-	       (format t "Dealing with ~a => ~a~%" k async-fd)
-
+	       (format-log t "Dealing with ~a => ~a~%" k async-fd)
+	       
 	       ;process reads
 	       (when (read-ready async-fd) (read-more async-fd))
 	       (when (> (buffer-position (foreign-read-buffer async-fd)) 0)
@@ -115,7 +115,7 @@
 
 			 ;; no accept, close
 			 (t
-			  (format t "start-server - accept-connection closed~%")
+			  (format-log t "start-server - accept-connection closed~%")
 			  (close-async-fd async-fd)))))
 
 
@@ -136,12 +136,11 @@
 
 			     (when (read-event-p event) (setf (read-ready async-fd) t))
 			     (when (write-event-p event) (setf (write-ready async-fd) t)))))))))
-	     (format t "Process client adds~%")
 
 					;add outgoing sockets to event queue
-	     (format t "start-server::sockets enqueued ~A~%" +connected-sockets+)
+	     (format-log t "nio-server:start-server - Processing client add ~A~%" +connected-sockets+)
 	     (loop for new-fd in +connected-sockets+ do
-		  (format t "Dealing with ~A~%" new-fd)
+		  (format-log t "nio-server:start-server - Dealing with ~A~%" new-fd)
 		  (setf (gethash (async-fd-read-fd new-fd) client-hash) new-fd)
 		  (add-async-fd event-queue new-fd :read-write))
 
@@ -168,7 +167,7 @@
     (if (connect-inet-socket sock host port)
     	(let ((sm (create-state-machine connection-type sock sock sock)))
   	  (push sm +connected-sockets+) 
-  	  (format t "add-connection::sockets enqueued ~A~%" +connected-sockets+)
+  	  (format-log t "nio-server:add-connection - Socket enqueued: ~A~%" +connected-sockets+)
 	  (return-from add-connection sm))
   	(format t "Connect failed!!~A ~%" (get-errno)))))
    
\ No newline at end of file

Modified: branches/home/psmith/restructure/src/protocol/yarpc/yarpc-client-state-machine.lisp
==============================================================================
--- branches/home/psmith/restructure/src/protocol/yarpc/yarpc-client-state-machine.lisp	(original)
+++ branches/home/psmith/restructure/src/protocol/yarpc/yarpc-client-state-machine.lisp	Mon Jan 22 00:54:43 2007
@@ -56,16 +56,16 @@
 (defconstant STATE-SENT-REQUEST 1)
 
 (defmethod process-outgoing-packet((sm yarpc-client-state-machine))
-  (format t "process-outgoing-packet called, polling the job-queue ~%")
+  (format-log t "yarpc-client-state-machine:process-outgoing-packet called, polling the job-queue ~%")
   (let ((packet (nio-compat:take (job-queue sm) :blocking-call nil)))
     (when packet
-      (format t "process-outgoing-packet got job ~A ~%" packet)
+      (format-log t "yarpc-client-state-machine:process-outgoing-packet got job ~A ~%" packet)
       (setf (state sm) STATE-SENT-REQUEST))
       packet))
 
 (defmethod process-incoming-packet ((sm yarpc-client-state-machine) (response method-response-packet))
   (assert (eql (state sm) STATE-SENT-REQUEST))
-  (format t "yarpc-client-state-machine:process-incoming-packet called :sm ~A :packet ~A~%" sm response)
+  (format-log t "yarpc-client-state-machine:process-incoming-packet called :sm ~A :packet ~A~%" sm response)
   (let* ((*package* (find-package :nio-yarpc))
          (result  (read-from-string (response response))))
     (setf (state sm) STATE-INITIALISED)    

Modified: branches/home/psmith/restructure/src/protocol/yarpc/yarpc-packet-factory.lisp
==============================================================================
--- branches/home/psmith/restructure/src/protocol/yarpc/yarpc-packet-factory.lisp	(original)
+++ branches/home/psmith/restructure/src/protocol/yarpc/yarpc-packet-factory.lisp	Mon Jan 22 00:54:43 2007
@@ -42,8 +42,8 @@
   (flip buf)
   (let ((ret (if (> (remaining buf) 0) ;; First byte denotes packet ID
 		 (ecase (elt (bytebuffer-read-vector buf 1) 0)
-		   (0 (progn (format t "got CALL-METHOD-PACKET-ID~%") (call-method-packet (bytebuffer-read-string buf (remaining buf)))))
-		   (1 (progn (format t "got METHOD-RESPONSE-PACKET-ID~%") (method-response-packet (bytebuffer-read-string buf (remaining buf)))))))))
+		   (0 (progn (format-log t "yarpc-packet-factory:get-packet - got CALL-METHOD-PACKET-ID~%") (call-method-packet (bytebuffer-read-string buf (remaining buf)))))
+		   (1 (progn (format-log t "yarpc-packet-factory:get-packet - got METHOD-RESPONSE-PACKET-ID~%") (method-response-packet (bytebuffer-read-string buf (remaining buf)))))))))
     (if (> (remaining buf) 0)
 	(error 'not-implemented-yet)
 	(clear buf))
@@ -59,10 +59,10 @@
   (format stream "#<CALL-METHOD-PACKET ~A >" (call-string packet)))
 
 (defmethod write-bytes((packet call-method-packet) buf)
-#+nio-debug  (format t "yarpc-packet-factory:write-bytes - writing ~A to ~A~%" packet buf)
+#+nio-debug  (format-log t "yarpc-packet-factory:write-bytes - writing ~A to ~A~%" packet buf)
   (nio-buffer:bytebuffer-write-vector buf #(#x0))
   (nio-buffer:bytebuffer-write-string buf (call-string packet))
-#+nio-debug    (format t "yarpc-packet-factory:write-bytes - written ~A~%" buf)  
+#+nio-debug    (format-log t "yarpc-packet-factory:write-bytes - written ~A~%" buf)  
 )
   
 
@@ -77,8 +77,8 @@
   (format stream "#<METHID-RESPONSE-PACKET ~A >" (response packet)))
 
 (defmethod write-bytes((packet method-response-packet) buf)
-#+nio-debug    (format t "yarpc-packet-factory:write-bytes - writing ~A to ~A~%" packet buf)
+#+nio-debug    (format-log t "yarpc-packet-factory:write-bytes - writing ~A to ~A~%" packet buf)
   (nio-buffer:bytebuffer-write-vector buf #(#x1))
   (nio-buffer:bytebuffer-write-string buf (write-to-string (response packet)))
-#+nio-debug    (format t "yarpc-packet-factory:write-bytes - written ~A~%" buf)  
+#+nio-debug    (format-log t "yarpc-packet-factory:write-bytes - written ~A~%" buf)  
 )

Modified: branches/home/psmith/restructure/src/protocol/yarpc/yarpc-state-machine.lisp
==============================================================================
--- branches/home/psmith/restructure/src/protocol/yarpc/yarpc-state-machine.lisp	(original)
+++ branches/home/psmith/restructure/src/protocol/yarpc/yarpc-state-machine.lisp	Mon Jan 22 00:54:43 2007
@@ -59,23 +59,23 @@
 
 
 (defun run-job(&key (wait-on-job-pdw t))
-  (format-log t "Server toplevel waiting for job~%")
+  (format-log t "yarpc-state-machine:run-job - Server toplevel waiting for job~%")
   (destructuring-bind (job result-queue) (nio-compat:take nio-yarpc:job-queue :blocking-call wait-on-job-pdw)
-    (format-log t "Server received job ~A~%" job)
+    (format-log t "yarpc-state-machine:run-job - Server received job ~A~%" job)
     (nio-compat:add result-queue (nio-yarpc:execute-call job))))
 
 
 (defmethod process-outgoing-packet((sm yarpc-state-machine))
-  (format-log t "yarpc-state-machine: process-outgoing-packet called, polling the results-queue ~%" )
+  (format-log t "yarpc-state-machine:process-outgoing-packet - called, polling the results-queue ~%" )
   (let ((result (nio-compat:take (result-queue sm) :blocking-call nil)))
-    (format t "yarpc-state-machine: process-outgoing-packet got result ~A ~%" result)
+    (format-log t "yarpc-state-machine:process-outgoing-packet - got result ~A ~%" result)
      (when result
 	(method-response-packet result))))
 
 ;Process a call method packet by placing it in the job-queue
 (defmethod process-incoming-packet ((sm yarpc-state-machine) (call call-method-packet))
   (assert (eql (state sm) STATE-INITIALISED))
-  (format-log t "yarpc-state-machine:process-incoming-packet called :sm ~A :packet ~A~%" sm call)
+  (format-log t "yarpc-state-machine:process-incoming-packet - called :sm ~A :packet ~A~%" sm call)
   (nio-compat:add job-queue (list (call-string call) (result-queue sm)))
   (when +process-jobs-inline+ (run-job :wait-on-job-pdw nil)))
 
@@ -104,7 +104,7 @@
 (defun execute-call (call-string)
       (let* ((rpc-call-list (read-from-string call-string ))
 	     (fn (member (symbol-function (first rpc-call-list)) *remote-fns* )))
-	(format t "fn - ~A authorised? : ~A~%" (symbol-function (first rpc-call-list)) fn)
+	(format-log t "yarpc-state-machine:execute-call - fn ~A authorised? : ~A~%" (symbol-function (first rpc-call-list)) fn)
 	(if fn
 	    (apply (first rpc-call-list) (rest rpc-call-list))
 	    (error 'authorization-error))))



More information about the Nio-cvs mailing list