emacs-31 4f6b6f462c1 1/3: jsonrpc-shutdown: Ensure we wait whole timeout & increase timeout

Sean Whitton <[email protected]>
Newsgroups gmane.emacs.diffs
Message-ID <[email protected]>
branch: emacs-31
commit 4f6b6f462c1f2858d98c2f81608f7b23077adbe9
Author: João Távora <[email protected]>
Commit: Sean Whitton <[email protected]>

    jsonrpc-shutdown: Ensure we wait whole timeout & increase timeout
    
    * lisp/jsonrpc.el (jsonrpc-shutdown): Ensure that we wait for
    the whole timeout and increase the timeout to 300ms (bug#80140).
---
 lisp/jsonrpc.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lisp/jsonrpc.el b/lisp/jsonrpc.el
index 174c99afc86..362f4eb1100 100644
--- a/lisp/jsonrpc.el
+++ b/lisp/jsonrpc.el
@@ -678,14 +678,16 @@ If CONN is not shutdown within a reasonable amount of time, warn
 and delete the network process."
   (unwind-protect
       (cl-loop
-       with proc = (jsonrpc--process conn) for i from 0
+       with proc = (jsonrpc--process conn)
+       with grace = 0.3 with start = (float-time)
+       for i from 0
        while (not (process-get proc 'jsonrpc-sentinel-cleanup-started))
-       unless (zerop i) do
+       unless (or (zerop i) (< (- (float-time) start) grace)) do
        (jsonrpc--warn "Sentinel for %s still hasn't run, deleting it!" proc)
        (delete-process proc)
        do
        ;; Let sentinel have a chance to run
-       (accept-process-output nil 0.1))
+       (accept-process-output nil grace))
     (when cleanup
       (kill-buffer (process-buffer (jsonrpc--process conn)))
       (kill-buffer (jsonrpc-stderr-buffer conn)))))
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.