From: Taylor R Campbell Date: Tue, 11 Dec 2012 20:16:28 +0000 (+0000) Subject: Fix READ-PACKET in swank.scm to cope with partial reads. X-Git-Tag: release-9.2.0~209 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=19888e97aab635b8adf1890e2020cf060736ac04;p=mit-scheme.git Fix READ-PACKET in swank.scm to cope with partial reads. Thanks, ecraven. --- diff --git a/src/runtime/swank.scm b/src/runtime/swank.scm index 48239cf71..77bb51c78 100644 --- a/src/runtime/swank.scm +++ b/src/runtime/swank.scm @@ -144,8 +144,15 @@ USA. (dispatch (decode-message socket (read-packet socket)) socket level)) (define (read-packet in) - (if (eof-object? (peek-char in)) - (disconnect)) + (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 (let ((buffer (make-string 6)))