From 978d0c0de17d3a6e92b15131c3370613f46e7117 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Wed, 2 Mar 2016 01:50:42 -0800 Subject: [PATCH] Apply swank patch from craven@gmx.net. --- src/runtime/swank.scm | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/src/runtime/swank.scm b/src/runtime/swank.scm index 24f7051be..63023583a 100644 --- a/src/runtime/swank.scm +++ b/src/runtime/swank.scm @@ -145,22 +145,17 @@ USA. (dispatch (decode-message socket (read-packet socket)) socket level)) (define (read-packet in) - (define (read-string! buffer in) - (let loop ((i 0)) - (if (< i (string-length buffer)) - (let ((n (read-substring! buffer i (string-length buffer) in))) - ;; (assert (exact-nonnegative-integer? n)) - ;; (assert (<= n (- (string-length buffer) i))) - (if (zero? n) ;EOF - (disconnect)) - (loop (+ i n)))))) - (let ((buffer - (make-string + (if (eof-object? (peek-char in)) + (disconnect)) + (let* ((end (let ((buffer (make-string 6))) (read-string! buffer in) - (string->number buffer 16 #t))))) - (read-string! buffer in) - buffer)) + (string->number buffer 16 #t))) + (buffer (make-string end))) + (let loop ((start 0)) + (if (< start end) + (loop (+ start (read-substring! buffer start end in))) + buffer)))) (define (decode-message socket packet) (bind-condition-handler (list condition-type:serious-condition) -- 2.25.1