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

From: Lars Ingebrigtsen <[email-masked]>
Date: Sun, 28 Feb 2016 14:01:19 +1030

Alain Schneble <[email-masked]> writes:

> Here we go.  I think we are getting closer to the root cause of the
> problem.  In w32.c (sys_write), it runs into the following error:
>
>       if (nchars == SOCKET_ERROR)
>         {
> 	  DebPrint (("sys_write.send failed with error %d on socket %ld\n",
> 		     pfn_WSAGetLastError (), SOCK_HANDLE (fd)));
> 	  set_errno ();
> 	}
>
> Strange thing: set_errno returns with errno == 0.  This because
> pfn_WSAGetLastError returns 0 as well.
>
> Now, if I do...
>
> 	  if (errno == 0)
> 	    errno = EAGAIN;
>
> ...just after the call to set_errno above, guess what: It seems to work!

Aha!  Good sleuthing.  :-)

> At least for me, it will be an exercise for tomorrow to find the reason
> why pfn_WSAGetLastError returns 0 in this case.  *snore*
>
> Do you agree it shouldn't return 0?

Yes.  That would make more sense.

Both I don't think that code path (sys_write) has ever been called
before on a nonblocking socket.  (Because we've always opened the
sockets before without O_NONBLOCK, since we've never called
`make-network-process' with :nowait t before from `open-gnutls-stream'.)

So ... is it possible that these functions that w32.c calls just
don't...  quite work with nonblocking sockets?

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