Ticket #1579: 0001-Use-port-closed-instead-of-sys-slot-fixing-output-ha.patch

File 0001-Use-port-closed-instead-of-sys-slot-fixing-output-ha.patch, 1.1 KB (added by Jim Ursetto, 6 years ago)
  • spiffy.scm

    From c242845303461c358a46ea408f25c6b0f3d3307d Mon Sep 17 00:00:00 2001
    From: Jim Ursetto <jim@3e8.org>
    Date: Thu, 17 Jan 2019 12:16:11 -0600
    Subject: [PATCH] Use port-closed? instead of ##sys#slot, fixing output hangs
    
    Port slot 8 (closed?) changed from a bool to a fixnum
    in Chicken 5, which made the existing port closed test always succeed,
    so output was never flushed. This can lead to hangs when output size
    is less than tcp-buffer-size. Use the official accessor instead.
    ---
     spiffy.scm | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/spiffy.scm b/spiffy.scm
    index 83f51cf..83fe21b 100644
    a b  
    531531                     (send-status 'bad-request
    532532                                  (conc "<p>Your client sent a request that "
    533533                                        "the server did not understand</p>")))
    534                  (unless (##sys#slot out 8) ;; port-closed?
     534                 (unless (port-closed? out)
    535535                   (flush-output out))
    536536                 (handle-another-request?)))))))) ; Keep going?
    537537