emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-25 a5dcc97: Fix open-network-stream responsiveness


From: Paul Eggert
Subject: [Emacs-diffs] emacs-25 a5dcc97: Fix open-network-stream responsiveness
Date: Tue, 5 Jul 2016 23:04:46 +0000 (UTC)

branch: emacs-25
commit a5dcc97babfcb20bd146376fec99a20b9320e9be
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    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:address@hidden
    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)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]