Changeset 70 for branches/home
- Timestamp:
- 02/05/07 04:51:51 (18 years ago)
- Location:
- branches/home/psmith/restructure/src/io
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified branches/home/psmith/restructure/src/io/async-fd.lisp ¶
r68 r70 78 78 (setf close-pending t))) 79 79 80 (define-condition read-error (error) ()) 80 (define-condition read-error (error) 81 ((errno :initform :errno 82 :accessor read-error-errno))) 81 83 82 84 ;; "Read more data from STATE-MACHINE." … … 89 91 (cond 90 92 ((< new-bytes 0) 91 (progn 92 ;;TODO if ret is -1 and errno is EAGAIN save state and wait for notification 93 (format t "read-error - Errno: ~A~%" (get-errno)) 94 (error 'read-error))) 93 (let ((errno (get-errno))) 94 (format t "read-error - Errno: ~A~%" errno) 95 (cond ((eql errno +ERRNO_EAGAIN+) 96 (setf (read-ready state-machine) nil)) 97 (t 98 (error 'read-error :errno errno))))) 95 99 ((= new-bytes 0) 96 100 nil);;(throw 'end-of-file nil) … … 98 102 ;;Update buffer position 99 103 (inc-position foreign-read-buffer new-bytes) 100 (setf (read-ready state-machine) nil)))))) 104 (when (> (remaining foreign-read-buffer) 0) 105 (setf (read-ready state-machine) nil))))))) 101 106 102 107 (defun close-async-fd (async-fd) -
TabularUnified branches/home/psmith/restructure/src/io/nio-server.lisp ¶
r65 r70 110 110 ;; accept connection ? 111 111 ((funcall accept-connection async-fd) 112 (set-fd-nonblocking (async-fd-read-fd async-fd)) 112 (sleep 0.1) 113 (let ((nb-ret (set-fd-nonblocking (async-fd-read-fd async-fd)))) 114 (format t "set bb ret: ~A :flags ~A~%" nb-ret (get-fd-flags (async-fd-read-fd async-fd))) 115 (when (< nb-ret 0) 116 (format t "Error setting socket non-blocking: ") 117 (perror))) 113 118 (setf (gethash (async-fd-read-fd async-fd) client-hash) async-fd) 114 119 (add-async-fd event-queue async-fd :read-write)
Note: See TracChangeset
for help on using the changeset viewer.