Changeset 106 for branches/home/psmith
- Timestamp:
- 03/18/07 01:07:13 (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 ¶
r100 r106 130 130 131 131 (defun write-more (async-fd) 132 "Write data from ASYNC-FD's write bytebuffer" 132 "Write data from ASYNC-FD's foreign-write-buffer to the network \ 133 Leaves foreign-write-buffer in state ready to be written to \ 134 Sets write-ready appropriatly" 133 135 #+nio-debug (format-log t "async-fd:write-more - called with ~A~%" async-fd) 134 136 (with-slots (write-fd foreign-write-buffer close-pending) async-fd … … 144 146 (inc-position foreign-write-buffer now-written) 145 147 (incf total-written now-written))) 146 #+nio-debug (format t "async-fd:write-more - after write :foreign-write-buffer ~A :now-written ~A :total-written ~A ~%" foreign-write-buffer now-written total-written)) 147 (if (eql now-written -1) 148 #+nio-debug (format t "async-fd:write-more - after write :foreign-write-buffer ~A :now-written ~A :total-written ~A ~%" foreign-write-buffer now-written total-written) 149 ) 150 151 (when (eql now-written -1) 148 152 ;;Deal with failure 149 153 (let ((err (get-errno))) 150 (format t "write-more - write returned -1 :errno ~A~%" err) 151 (unless (eql err 11) ;; eagain - failed to write whole buffer need to wait for next notify 152 (perror) 153 (let ((err-cond (make-instance 'write-error :error err))) 154 (close-fd (write-fd async-fd)); - deal with in nio-server? 155 (error err-cond)))) 156 ;;update buffers 157 (if (eql (remaining foreign-write-buffer) 0) 158 (clear foreign-write-buffer) 159 (error 'not-implemented-yet)))) 160 154 #+nio-debug (format t "write-more - write returned -1 :errno ~A~%" err) 155 (if (eql err 11) ;; eagain - failed to write whole buffer need to wait for next notify 156 (setf (write-ready async-fd) nil) 157 (progn 158 (perror) 159 (let ((err-cond (make-instance 'write-error :error err))) 160 (close-fd (write-fd async-fd)); - deal with in nio-server? 161 (error err-cond)))))) 162 ;;update buffers 163 (if (eql (remaining foreign-write-buffer) 0) 164 (clear foreign-write-buffer) 165 (compact foreign-write-buffer))) 161 166 #+nio-debug (format t "write buffer after write :~A~%" foreign-write-buffer) 162 167 (when (eql (buffer-position foreign-write-buffer) 0) -
TabularUnified branches/home/psmith/restructure/src/io/nio-server.lisp ¶
r105 r106 51 51 (process-read async-fd)) 52 52 ;process-writes 53 (process-write async-fd) 54 (when (and (write-ready async-fd) 55 (> (buffer-position (foreign-write-buffer async-fd)) 0)) 56 (write-more async-fd)) 53 (loop 54 (when (and (write-ready async-fd) (> (buffer-position (foreign-write-buffer async-fd)) 0)) 55 (write-more async-fd)) 56 (when (write-ready async-fd) 57 (assert (eql (buffer-position (foreign-write-buffer async-fd)) 0)) 58 (process-write async-fd)) 59 (unless (and (write-ready async-fd) (> (buffer-position (foreign-write-buffer async-fd)) 0)) (return))) 60 57 61 ;process normal close 58 62 (when (close-pending async-fd) … … 193 197 (progn 194 198 (format t "Connect failed!!~A ~%" (get-errno)) 195 (close-fd sock))))) 199 (close-fd sock) 200 nil)))) 196 201 197 202 (defun add-connection(node)
Note: See TracChangeset
for help on using the changeset viewer.