unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Paul Eggert <eggert@cs.ucla.edu>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 23864@debbugs.gnu.org, che@chrekh.se
Subject: bug#23864: 25.1.50; Poor network responsivenes using open-network-stream
Date: Tue, 5 Jul 2016 20:43:48 +0200	[thread overview]
Message-ID: <577BFFE4.9090505@cs.ucla.edu> (raw)
In-Reply-To: <83poqtpj2m.fsf@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 154 bytes --]

On 07/04/2016 04:35 PM, Eli Zaretskii wrote:
> Do you consider these changes safe for back-porting to emacs-25?

Yes. Propose patch to emacs-25 attached.

[-- Attachment #2: 0001-Fix-open-network-stream-responsiveness.patch --]
[-- Type: text/x-patch, Size: 1916 bytes --]

From ea23b4519698c9695a851508c3455f36ff94115b Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Tue, 5 Jul 2016 20:40:40 +0200
Subject: [PATCH] Fix open-network-stream responsiveness

Problem reported by Christer Ekholm (Bug#23864).
Backport from master.
* src/process.c (wait_reading_process_output):
Fix typo introduced in 2015-07-06T02:19:13Z!eggert@cs.ucla.edu
when wait == INFINITY and got_output_end_time is invalid.
In this case the code should break, not continue.
---
 src/process.c | 22 ++++++++++++++--------
 1 file changed, 14 insertions(+), 8 deletions(-)

diff --git a/src/process.c b/src/process.c
index 14d7b6d..0593429 100644
--- a/src/process.c
+++ b/src/process.c
@@ -4911,16 +4911,22 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
              haven't lowered our timeout due to timers or SIGIO and
              have waited a long amount of time due to repeated
              timers.  */
+	  struct timespec huge_timespec
+	    = make_timespec (TYPE_MAXIMUM (time_t), 2 * TIMESPEC_RESOLUTION);
+	  struct timespec cmp_time = huge_timespec;
 	  if (wait < TIMEOUT)
 	    break;
-	  struct timespec cmp_time
-	    = (wait == TIMEOUT
-	       ? end_time
-	       : (!process_skipped && got_some_output > 0
-		  && (timeout.tv_sec > 0 || timeout.tv_nsec > 0))
-	       ? got_output_end_time
-	       : invalid_timespec ());
-	  if (timespec_valid_p (cmp_time))
+	  if (wait == TIMEOUT)
+	    cmp_time = end_time;
+	  if (!process_skipped && got_some_output > 0
+	      && (timeout.tv_sec > 0 || timeout.tv_nsec > 0))
+	    {
+	      if (!timespec_valid_p (got_output_end_time))
+		break;
+	      if (timespec_cmp (got_output_end_time, cmp_time) < 0)
+		cmp_time = got_output_end_time;
+	    }
+	  if (timespec_cmp (cmp_time, huge_timespec) < 0)
 	    {
 	      now = current_timespec ();
 	      if (timespec_cmp (cmp_time, now) <= 0)
-- 
2.5.5


  reply	other threads:[~2016-07-05 18:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-28 19:24 bug#23864: 25.1.50; Poor network responsivenes using open-network-stream Christer Ekholm
2016-06-30  1:50 ` Glenn Morris
2016-07-03  9:01   ` Paul Eggert
2016-07-03 11:21     ` Christer Ekholm
2016-07-03 15:21       ` Eli Zaretskii
2016-07-03 18:54         ` Christer Ekholm
2016-07-03 22:51           ` Paul Eggert
2016-07-04  7:34             ` Christer Ekholm
2016-07-04 14:35             ` Eli Zaretskii
2016-07-05 18:43               ` Paul Eggert [this message]
2016-07-05 19:46                 ` Eli Zaretskii
2016-07-05 23:10                   ` Paul Eggert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=577BFFE4.9090505@cs.ucla.edu \
    --to=eggert@cs.ucla.edu \
    --cc=23864@debbugs.gnu.org \
    --cc=che@chrekh.se \
    --cc=eliz@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).