[Top][All Lists]

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

bug#23658: 25.1.50; make-network-connection fails to connect to IPv6 add

From: Ken Brown
Subject: bug#23658: 25.1.50; make-network-connection fails to connect to IPv6 address on Windows
Date: Thu, 2 Jun 2016 10:50:19 -0400
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1

On 6/1/2016 5:55 PM, Ken Brown wrote:
> On 6/1/2016 3:57 PM, Fran wrote:
>> Removing the ":nowait t" makes it connect successfully to the IPv6
>> address. In that case, it works regardless of whether ":family 'ipv6"
>> is present. If this were my personal code that would be a sufficient
>> workaround, but I found this bug in ERC (the Emacs IRC client), and I
>> think it is designed so that make-network-process has to connect
>> asynchronously.
> This sounds similar to the situation I faced in bug#23606.  (But in that
> case specifying :family solved the problem).  Here's what I suspect is
> happening:
> In src/process.c there's a loop starting at line 3138 in which the code
> runs through a list of possible addrinfo structures in the hopes of
> finding one it can connect to.  In the asynchronous case, it doesn't
> wait to see if the connection is successful; this is only discovered
> later (around line 5495).  At this point it's too late to try another
> addrinfo structure, and a "failed" message is generated (line 5523) if
> the connection didn't succeed.

While we're waiting for an expert to respond to this, it's easy to test if my 
guess is correct.  Please apply the following patch, rebuild, and retry your 

diff --git a/src/process.c b/src/process.c
index 9ca3e594..30a200f 100644
--- a/src/process.c
+++ b/src/process.c
@@ -3135,6 +3135,7 @@ connect_network_socket (Lisp_Object proc, Lisp_Object 
   count1 = SPECPDL_INDEX ();
   s = -1;
+  int addrinfo_count = 0;
   while (!NILP (addrinfos))
       Lisp_Object addrinfo = XCAR (addrinfos);
@@ -3142,6 +3143,8 @@ connect_network_socket (Lisp_Object proc, Lisp_Object 
       int protocol = XINT (XCAR (addrinfo));
       Lisp_Object ip_address = XCDR (addrinfo);
+      message ("Trying addrinfo structure %d", ++addrinfo_count);

This will print a message in the echo area (and the *Messages* buffer) on each 
iteration of the loop.  If my guess is correct, you should see more than one 
iteration in the IPv6 case if ":nowait t" is removed.  It would also be 
interesting to see if ":family 'ipv6" has any effect, again without ":nowait t".


reply via email to

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