From 17a6909d9508e48f03aabf02f9edb68e83dad733 Mon Sep 17 00:00:00 2001 From: ueno Date: Fri, 5 Nov 2004 02:17:23 +0000 Subject: [PATCH] * riece-rdcc.el (riece-rdcc-block-size): Changed default value to 1024 due to the DCC specification. (riece-rdcc-send-program): Wait ack from a recipient. (riece-rdcc-filter): Send ack each time data arrives. --- lisp/ChangeLog | 7 +++++++ lisp/riece-rdcc.el | 23 +++++++++++++++++------ 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a70a008..52d7819 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2004-11-05 Daiki Ueno + + * riece-rdcc.el (riece-rdcc-block-size): Changed default value to + 1024 due to the DCC specification. + (riece-rdcc-send-program): Wait ack from a recipient. + (riece-rdcc-filter): Send ack each time data arrives. + 2004-10-30 Daiki Ueno * riece-yank.el (riece-yank-strip-space): New user option. diff --git a/lisp/riece-rdcc.el b/lisp/riece-rdcc.el index 21fab6f..4a34937 100644 --- a/lisp/riece-rdcc.el +++ b/lisp/riece-rdcc.el @@ -62,8 +62,11 @@ if session File.open(" file ") {|file| while (bytes = file.read(" block-size ")) total += bytes.length - puts(\"#{total}\") + puts(total) session.write(bytes) + begin + buf = session.read(4) + end until buf.unpack('N')[0] == total end } session.close @@ -86,7 +89,7 @@ puts(\"#{" address " >> 24 & 0xFF}.#{" address " >> 16 & 0xFF}.#{" :type 'directory :group 'riece-rdcc) -(defcustom riece-rdcc-block-size 4096 +(defcustom riece-rdcc-block-size 1024 "Number of bytes sent as a block." :type 'integer :group 'riece-rdcc) @@ -198,13 +201,21 @@ puts(\"#{" address " >> 24 & 0xFF}.#{" address " >> 16 & 0xFF}.#{" (let ((coding-system-for-write 'binary) jka-compr-compression-info-list jam-zcat-filename-list) (write-region (point-min) (point-max) riece-rdcc-temp-file t 0)) + (setq riece-rdcc-received-size (+ (buffer-size) riece-rdcc-received-size)) + (process-send-string + process + (format "%c%c%c%c" + (lsh riece-rdcc-received-size -24) + (logand (lsh riece-rdcc-received-size -16) 255) + (logand (lsh riece-rdcc-received-size -8) 255) + (logand riece-rdcc-received-size 255))) (message "Receiving %s from %s...(%s/%s)" (file-name-nondirectory riece-rdcc-request-file) riece-rdcc-request-user - (riece-rdcc-format-size - (setq riece-rdcc-received-size (+ (buffer-size) - riece-rdcc-received-size))) - (riece-rdcc-format-size riece-rdcc-request-size)))) + (riece-rdcc-format-size riece-rdcc-received-size) + (riece-rdcc-format-size riece-rdcc-request-size)) + (if (= riece-rdcc-received-size riece-rdcc-request-size) + (set-process-filter process nil)))) (defun riece-rdcc-sentinel (process status) (save-excursion -- 1.7.10.4