From: ueno Date: Sat, 25 Sep 2004 05:33:56 +0000 (+0000) Subject: Fixed. X-Git-Tag: riece-1_0_4~15 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=461a2538eb530cc47459320d3bffde50cf94537e;p=elisp%2Friece.git Fixed. --- diff --git a/lisp/riece-options.el b/lisp/riece-options.el index d7306da..c8ee92b 100644 --- a/lisp/riece-options.el +++ b/lisp/riece-options.el @@ -178,12 +178,12 @@ way is to put Riece variables on .emacs or file loaded from there." :type 'symbol :group 'riece-server) -(defcustom riece-max-send-size 1500 +(defcustom riece-max-send-size 512 "Maximum size of messages to be sent at a time." :type 'integer :group 'riece-server) -(defcustom riece-send-delay 1 +(defcustom riece-send-delay 8 "Duration of multiple send." :type 'integer :group 'riece-server) diff --git a/lisp/riece-server.el b/lisp/riece-server.el index 9002676..10166de 100644 --- a/lisp/riece-server.el +++ b/lisp/riece-server.el @@ -114,8 +114,7 @@ the `riece-server-keyword-map' variable." ;; stolen (and renamed) from time-date.el. (defun riece-time-since (time) - "Return the time elapsed since TIME. -TIME should be either a time value or a date-time string." + "Return the time elapsed since TIME." (let* ((current (current-time)) (rest (when (< (nth 1 current) (nth 1 time)) (expt 2 16)))) @@ -137,26 +136,19 @@ TIME should be either a time value or a date-time string." (riece-time-since riece-last-send-time)) (setq riece-send-size 0)) (while (and riece-send-queue - (< riece-send-size riece-max-send-size)) + (<= riece-send-size riece-max-send-size)) (setq string (riece-encode-coding-string (car riece-send-queue)) length (length string)) (if (> length riece-max-send-size) (message "Long message (%d > %d)" length riece-max-send-size) - (process-send-string process string) - (setq riece-send-size (+ riece-send-size length))) + (setq riece-send-size (+ riece-send-size length)) + (when (<= riece-send-size riece-max-send-size) + (process-send-string process string) + (setq riece-last-send-time (current-time)))) (setq riece-send-queue (cdr riece-send-queue))) (if riece-send-queue - (progn - (if riece-debug - (message "%d bytes sent, %d bytes left" - riece-send-size - (apply #'+ (mapcar #'length riece-send-queue)))) - ;; schedule next send after a second - (riece-run-at-time riece-send-delay nil - #'riece-flush-send-queue process)) - (if riece-debug - (message "%d bytes sent" riece-send-size))) - (setq riece-last-send-time (current-time))))) + (riece-run-at-time riece-send-delay nil + #'riece-flush-send-queue process))))) (defun riece-process-send-string (process string) (with-current-buffer (process-buffer process)