[nio-cvs] r74 - in branches/home/psmith/restructure/src: io nio-logger protocol/yarpc
psmith at common-lisp.net
psmith at common-lisp.net
Tue Feb 6 03:43:59 UTC 2007
Author: psmith
Date: Mon Feb 5 22:43:57 2007
New Revision: 74
Modified:
branches/home/psmith/restructure/src/io/async-fd.lisp
branches/home/psmith/restructure/src/io/nio-package.lisp
branches/home/psmith/restructure/src/io/nio-server.lisp
branches/home/psmith/restructure/src/nio-logger/nio-logger.asd
branches/home/psmith/restructure/src/nio-logger/nio-logger.lisp
branches/home/psmith/restructure/src/protocol/yarpc/yarpc-state-machine.lisp
Log:
Changes for server close
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 Feb 5 22:43:57 2007
@@ -43,7 +43,8 @@
(write-ready :initform nil
:accessor write-ready
:documentation "Have we been notified as write ready and not received EAGAIN from %write?")
- (close-pending :initform nil)
+ (close-pending :initform nil
+ :accessor close-pending)
(socket :initarg :socket
:accessor socket)))
@@ -151,7 +152,7 @@
(error 'not-implemented-yet))))
#+nio-debug (format t "write buffer after write :~A~%" foreign-write-buffer)
- (when (eql (remaining foreign-write-buffer) 0)
+ (when (eql (buffer-position foreign-write-buffer) 0)
(when close-pending (close-async-fd async-fd)))))
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 Feb 5 22:43:57 2007
@@ -30,7 +30,7 @@
;; async-fd.lisp
async-fd process-read process-write foreign-read-buffer foreign-write-buffer close-sm
- recommend-buffer-size
+ recommend-buffer-size close-pending
;; async-socket.lisp
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 Feb 5 22:43:57 2007
@@ -39,7 +39,8 @@
;loop over hashtable
(defun process-async-fds (client-hash)
- (maphash #'(lambda (k async-fd)
+ (let ((removals nil))
+ (maphash #'(lambda (k async-fd)
(format-log t "Dealing with ~a => ~a~%" k async-fd)
;process reads
@@ -50,9 +51,16 @@
;process-writes
(process-write async-fd)
(when (and (write-ready async-fd)
- (> (buffer-position (foreign-write-buffer async-fd)) 0))
- (write-more async-fd)))
- client-hash))
+ (> (buffer-position (foreign-write-buffer async-fd)) 0))
+ (write-more async-fd))
+
+ (when (close-pending async-fd)
+ (write-more async-fd)
+ (push async-fd removals)))
+ client-hash)
+ (dolist (async-fd removals)
+ (remhash (async-fd-read-fd async-fd) client-hash))
+ (format t "client-hash list ~A~%"client-hash )))
Modified: branches/home/psmith/restructure/src/nio-logger/nio-logger.asd
==============================================================================
--- branches/home/psmith/restructure/src/nio-logger/nio-logger.asd (original)
+++ branches/home/psmith/restructure/src/nio-logger/nio-logger.asd Mon Feb 5 22:43:57 2007
@@ -8,5 +8,5 @@
(:file "nio-logger" :depends-on ("nio-logger-package"))
)
- :depends-on (:nio-yarpc :nio-utils))
+ :depends-on (:nio-yarpc :nio-utils :cl-base64))
Modified: branches/home/psmith/restructure/src/nio-logger/nio-logger.lisp
==============================================================================
--- branches/home/psmith/restructure/src/nio-logger/nio-logger.lisp (original)
+++ branches/home/psmith/restructure/src/nio-logger/nio-logger.lisp Mon Feb 5 22:43:57 2007
@@ -50,7 +50,7 @@
(let ((sm (nio:add-connection ip-address 16323 'nio-yarpc:yarpc-client-state-machine)))
(nio-utils:format-log t "toplevel adding conn ~A to ~A~%" sm ip-address)
(with-line-from-tailed-file (text filename 1)
- (let ((rpc (format nil "(nio-logger:remote-log \"~A\")" text)))
+ (let ((rpc (format nil "(nio-logger:remote-log \"~A\")" (cl-base64:string-to-base64-string text))))
(nio-utils:format-log t "Toplevel Submitting job~A~%" rpc)
(nio-utils:format-log t "Result of remote-log ~A~%" (nio-yarpc:remote-execute sm rpc))))))
@@ -67,8 +67,8 @@
;;block waiting for jobs
(nio-yarpc:run-job)))
-(nio-yarpc:defremote remote-log(str)
+(nio-yarpc:defremote remote-log(base64-str)
(with-open-file (out +log-file-name+ :direction :output :if-exists :append)
- (nio-utils:format-log out "~A~%" str))
+ (nio-utils:format-log out "~A~%" (cl-base64:base64-string-to-string base64-str)))
t)
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 Feb 5 22:43:57 2007
@@ -102,12 +102,14 @@
(define-condition authorization-error (error) ())
(defun execute-call (call-string)
+ (handler-case
(let* ((rpc-call-list (read-from-string call-string ))
(fn (member (symbol-function (first rpc-call-list)) *remote-fns* )))
(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))))
+ (error 'authorization-error)))
+ (reader-error (re) (format-log t "yarpc-state-machine:execute-call - reader error on call-string ~A ~%" re))))
;;end move TODO
More information about the Nio-cvs
mailing list