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

From: Alain Schneble <[email-masked]>
Date: Sat, 27 Feb 2016 19:05:20 +0100

Lars Ingebrigtsen <[email-masked]> writes:

> (setq proc
> (make-network-process :name "foo"
> 		      :buffer (get-buffer-create "*foo*")
> 		      :host "imap.gmail.com"
> 		      :service 993
> 		      :nowait t
> 		      :tls-parameters
> 		      (cons 'gnutls-x509pki
> 			    (gnutls-boot-parameters
> 			     :type 'gnutls-x509pki
> 			     :hostname "imap.gmail.com"))))
>
> * OK Gimap ready for requests from 60.225.211.161 qr7mb410250987iec
>
> should appear.  Also, after evaling that, what does

It seems to be a timing issue.  If I set gnutls-log-level to 5, this
works also on Windows (i.e i get OK Gimap...).

What I found out is that it runs into the following branch in
wait_reading_process_output:

...
else
{
  /* Preserve status of processes already terminated.  */
  XPROCESS (proc)->tick = ++process_tick;
  deactivate_process (proc);
  if (XPROCESS (proc)->raw_status_new)
    update_status (XPROCESS (proc));
  if (EQ (XPROCESS (proc)->status, Qrun))
    pset_status (XPROCESS (proc),
                 list2 (Qexit, make_number (256)));
}

Here it deactivates the process, but as its status is "connect", it
won't change it.  That's the reason why it remains in "connect" state.

I guess that it enters this path because the socket is not ready yet.
But why?  I will try to figure it out later...