[nio-cvs] r101 - branches/home/psmith/restructure/src/protocol/yarpc

psmith at common-lisp.net psmith at common-lisp.net
Wed Feb 28 03:42:29 UTC 2007


Author: psmith
Date: Tue Feb 27 22:42:29 2007
New Revision: 101

Modified:
   branches/home/psmith/restructure/src/protocol/yarpc/nio-yarpc-package.lisp
   branches/home/psmith/restructure/src/protocol/yarpc/yarpc-client-state-machine.lisp
Log:
Allow simulated remote calls for testing

Modified: branches/home/psmith/restructure/src/protocol/yarpc/nio-yarpc-package.lisp
==============================================================================
--- branches/home/psmith/restructure/src/protocol/yarpc/nio-yarpc-package.lisp	(original)
+++ branches/home/psmith/restructure/src/protocol/yarpc/nio-yarpc-package.lisp	Tue Feb 27 22:42:29 2007
@@ -37,5 +37,5 @@
 	     test-rpc test-rpc-list test-rpc-string execute-call defremote
 	     
 	     ;;yarpc-client-state-machine
-	     yarpc-client-state-machine remote-execute
+	     yarpc-client-state-machine remote-execute simulate-connection
 	     ))

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	Tue Feb 27 22:42:29 2007
@@ -91,7 +91,19 @@
     (let ((remote-job (gethash request-id (request-map sm))))
       (funcall (callback remote-job) result))))
 
+(defparameter *simulate-calls* nil)
+
 ;Execute the call-string on the remote node and call callback with the result
 (defmethod remote-execute ((sm yarpc-client-state-machine) call-string callback)
 #+nio-debug  (format-log t "yarpc-client-state-machine:remote-execute called :sm ~A :call-string ~A :callback ~A~%" sm call-string callback)
-  (nio-utils:add (job-queue sm) (list (remote-job callback) call-string)))
+  (if *simulate-calls*
+    (funcall callback (execute-call call-string))
+    (nio-utils:add (job-queue sm) (list (remote-job callback) call-string))))
+
+
+(defun simulate-connection()
+  (setf *simulate-calls* t)
+  (let* ((node (nio:node "127.0.0.1" 9999)))
+         (setf (nio:active-conn node) (nio::create-state-machine 'yarpc-client-state-machine 1 1 6))
+    (push  node nio::*nodes-list*)))
+            



More information about the Nio-cvs mailing list