Changeset 70 for branches/home


Ignore:
Timestamp:
02/05/07 04:51:51 (18 years ago)
Author:
psmith
Message:

Large packet support working

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  
    7878      (setf close-pending t)))
    7979
    80 (define-condition read-error (error) ())
     80(define-condition read-error (error)
     81  ((errno :initform :errno
     82             :accessor read-error-errno)))
    8183
    8284;;  "Read more data from STATE-MACHINE."
     
    8991      (cond
    9092       ((< 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)))))
    9599       ((= new-bytes 0)
    96100        nil);;(throw 'end-of-file nil)
     
    98102          ;;Update buffer position
    99103          (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)))))))
    101106
    102107(defun close-async-fd (async-fd)
  • TabularUnified branches/home/psmith/restructure/src/io/nio-server.lisp

    r65 r70  
    110110                         ;; accept connection ?
    111111                         ((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)))
    113118                          (setf (gethash (async-fd-read-fd async-fd) client-hash) async-fd)
    114119                          (add-async-fd event-queue async-fd :read-write)
Note: See TracChangeset for help on using the changeset viewer.