bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#22789: 25.1.50; In last master build https connections stop working


From: Lars Ingebrigtsen
Subject: bug#22789: 25.1.50; In last master build https connections stop working
Date: Wed, 02 Mar 2016 18:03:57 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1.50 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

> So what you can do instead of launching a timer is this: as long as
> some process waits for some sync stuff to complete, reduce the timeout
> with which we call 'pselect' to some reasonably small value, like half
> a second or maybe 0.25 sec.  This will ensure the loop doesn't stop as
> long as we wait for at least one such connection.  (This will need a
> simple logic to not exit the loop too early; see the variable
> timeout_reduced_for_timers for a similar logic we employ already for
> timers.)

Aha!  With the following (for debugging purposes only) patch, it looks
like I'm getting progress on my https connections even if I don't have a
blinking cursor.  (I chose 50ms as my timeout, if I counted my zeroes
correctly...)  Were you thinking about something along these lines?  If
so, I can clean the patch up...

diff --git a/src/process.c b/src/process.c
index 85a4885..5376492 100644
--- a/src/process.c
+++ b/src/process.c
@@ -4870,6 +4870,7 @@ wait_reading_process_output (intmax_t time_limit, int 
nsecs, int read_kbd,
   struct timespec got_output_end_time = invalid_timespec ();
   enum { MINIMUM = -1, TIMEOUT, INFINITY } wait;
   int got_some_output = -1;
+  bool retry_for_async;
   ptrdiff_t count = SPECPDL_INDEX ();
 
   /* Close to the current time if known, an invalid timespec otherwise.  */
@@ -4922,6 +4923,7 @@ wait_reading_process_output (intmax_t time_limit, int 
nsecs, int read_kbd,
        Lisp_Object process_list_head, aproc;
        struct Lisp_Process *p;
 
+       retry_for_async = false;
        FOR_EACH_PROCESS(process_list_head, aproc)
          {
            p = XPROCESS (aproc);
@@ -4935,6 +4937,8 @@ wait_reading_process_output (intmax_t time_limit, int 
nsecs, int read_kbd,
                    Lisp_Object ip_addresses = check_for_dns (aproc);
                    if (!NILP (ip_addresses) && !EQ (ip_addresses, Qt))
                      connect_network_socket (aproc, ip_addresses);
+                   else
+                     retry_for_async = true;
                  }
 #endif
 #ifdef HAVE_GNUTLS
@@ -4950,12 +4954,16 @@ wait_reading_process_output (intmax_t time_limit, int 
nsecs, int read_kbd,
                        gnutls_verify_boot (aproc, Qnil);
                        finish_after_tls_connection (aproc);
                      }
-                   else if (p->gnutls_handshakes_tried
-                            > GNUTLS_EMACS_HANDSHAKES_LIMIT)
+                   else
                      {
-                       deactivate_process (aproc);
-                       pset_status (p, list2 (Qfailed,
-                                              build_string ("TLS negotiation 
failed")));
+                       retry_for_async = true;
+                       if (p->gnutls_handshakes_tried
+                           > GNUTLS_EMACS_HANDSHAKES_LIMIT)
+                         {
+                           deactivate_process (aproc);
+                           pset_status (p, list2 (Qfailed,
+                                                  build_string ("TLS 
negotiation failed")));
+                         }
                      }
                  }
 #endif
@@ -5044,6 +5052,7 @@ wait_reading_process_output (intmax_t time_limit, int 
nsecs, int read_kbd,
          Ctemp = write_mask;
 
          timeout = make_timespec (0, 0);
+         printf("Timeout is %lu\n", timeout.tv_sec);
          if ((pselect (max (max_process_desc, max_input_desc) + 1,
                        &Atemp,
 #ifdef NON_BLOCKING_CONNECT
@@ -5222,6 +5231,15 @@ wait_reading_process_output (intmax_t time_limit, int 
nsecs, int read_kbd,
          if (timeout.tv_sec > 0 || timeout.tv_nsec > 0)
            now = invalid_timespec ();
 
+         if (retry_for_async
+             && (timeout.tv_sec > 0 || timeout.tv_nsec > 50000000))
+           {
+             timeout.tv_sec = 0;
+             timeout.tv_nsec = 50000000;
+           }
+
+         printf("Here timeout is %lu/%lu\n", timeout.tv_sec, timeout.tv_nsec);
+
 #if defined (HAVE_NS)
           nfds = ns_select
 #elif defined (HAVE_GLIB)


-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

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