Changeset 13417 in project


Ignore:
Timestamp:
02/27/09 22:19:55 (11 years ago)
Author:
sjamaan
Message:

Apply some more patches for keep-alive patches (thanks to Drew Hess)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/3/http/trunk/http-client.scm

    r13405 r13417  
    8888  (ensure-local-connections)
    8989  (hash-table-set! (connections) id (list in out)))
    90  
    91 (define (close-connection! id)
     90
     91(define (remove-connection! id)
    9292  (ensure-local-connections)
    9393  (let ((con (hash-table-ref (connections) id)))
    9494    (hash-table-delete! (connections) id)
     95    con))
     96
     97(define (close-connection! id)
     98  (let ((con (remove-connection! id)))
    9599    (close-input-port (car con))
    96100    (close-output-port (cadr con))))
     
    258262                               (make-property-condition 'i/o)
    259263                               (make-property-condition 'net))))
    260                      ((and in out))
    261                      ((and (string? header)
    262                            (is-keep-alive? header a))
    263                       (or (is-connected? id) (add-connection! id i o)))
     264                     ((and (is-keep-alive? header a)   ; server
     265                           (is-keep-alive? header as)) ; client
     266                      (unless (is-connected? id)
     267                        (add-connection! id i o)))
    264268                     (else
    265                       (set-finalizer! i close-input-port)
    266                       (set-finalizer! o close-output-port) ) )
     269                      (when (is-connected? id)
     270                        (remove-connection! id))
     271                      (close-output-port o)
     272                      (set-finalizer! i close-input-port)))
    267273               (values header a i o)))
    268274           (exn (exn i/o net)
Note: See TracChangeset for help on using the changeset viewer.