Author: psmith Date: Sat Feb 10 19:39:23 2007 New Revision: 83
Modified: branches/home/psmith/restructure/src/protocol/yarpc/yarpc-client-state-machine.lisp Log: first working multiplexing rpc
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 Sat Feb 10 19:39:23 2007 @@ -78,14 +78,18 @@ (when ttd (format-log t "yarpc-client-state-machine:process-outgoing-packet got job ~A ~%" ttd) (destructuring-bind (job call-string) ttd - (setf (gethash (1+ +request-id+) (request-map sm)) job) + (setf (gethash (incf +request-id+) (request-map sm)) job) (make-instance 'call-method-packet :call-string call-string :request-id +request-id+)))))
(defmethod process-incoming-packet ((sm yarpc-client-state-machine) (response method-response-packet)) (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)))) - (nio-compat:add (result-queue sm) result))) + (result (read-from-string (response response))) + (request-id (request-id response))) + (format-log t "yarpc-client-state-machine:process-incoming-packet :result ~A :request-id ~A~%" result request-id) + (maphash #'(lambda (k v) (format t "~a -> ~a~%" k v)) (request-map sm)) + (let ((remote-job (gethash request-id (request-map sm)))) + (funcall (callback remote-job) result))))
;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)