[Libwebsockets] 答复: A question about libwebsockets dns resolve

Andy Green andy at warmcat.com
Thu May 28 15:06:09 CEST 2020



On 5/28/20 12:51 PM, huangkaicheng wrote:
> Hi,
>       Can you please put a patch " modification about dns resolve recently " to v4.0-stable branch. Is allowed?

Unfortunately it changes the public abi, there are new struct members 
for controlling the timeout.

Although the rest of it is private and could be backported, it has some 
indirect big changes like modify the original timeout value.  I think 
some people will get surprised finding this potentially big change in a 
"stable" point release.

The Sai stuff is working on master and v4.0-stable isn't going to get 
it, it's going to be very handy to have the improved amount of CI also 
monitoring the stable release for breakages.  So I plan to make a 
v4.1-stable in a "small number of weeks".

I have some other changes / improvements that will break / add to the 
abi as well that need doing before then.

-Andy

> -----邮件原件-----
> 发件人: Andy Green [mailto:andy at warmcat.com]
> 发送时间: 2020年5月27日 15:43
> 收件人: huangkaicheng <huangkaicheng at huawei.com>; libwebsockets <libwebsockets at ml.libwebsockets.org>
> 抄送: Chenyake <chenyake at huawei.com>
> 主题: Re: 答复: [Libwebsockets] 答复: 回复: 答复: A question about libwebsockets dns resolve
> 
> 
> 
> On 5/27/20 8:31 AM, huangkaicheng wrote:
>> Hi,
>>
>>      I think you make a mistake, in windows you should use
>> WSAGetLastError() rather than errno. I modify it and it can connect
>> well now.
> 
> Right, LWS_ERRNO was invented for that but switching between posix and kinda-posix platforms it is easy to forget.  It's literally "connect()"
> like posix but somehow not "errno".
> 
> I pushed your fix squashed in the patch and hopefully that's it.
> 
> -Andy
> 
>> -----邮件原件-----
>> 发件人: Andy Green [mailto:andy at warmcat.com]
>> 发送时间: 2020年5月26日17:42
>> 收件人: huangkaicheng <huangkaicheng at huawei.com>; libwebsockets
>> <libwebsockets at ml.libwebsockets.org>
>> 抄送: Chenyake <chenyake at huawei.com>
>> 主题: Re: 答复: 答复: [Libwebsockets] 答复: 回复: 答复: A question about
>> libwebsockets dns resolve
>>
>> On 5/26/20 10:29 AM, huangkaicheng wrote:
>>
>>> bin\Debug\lws-minimal-http-client.exe --server 46.105.127.147 -m
>>
>>> -d1039
>>
>>>
>>
>>>
>>
>>> Can you change server to like " bin\Debug\lws-minimal-http-client.exe --server 46.105.127.147 -m -d1039"? it will also connect succfully?
>>
>> Yeah.
>>
>>> bin\Debug\lws-minimal-http-client.exe --server 46.105.127.147 -m
>>> -d1039
>>
>> [2020/05/26 10:37:29:1091] U: LWS minimal http client [-d<verbosity>]
>> [-l] [--h1]
>>
>> [2020/05/26 10:37:29:1091] I: Initial logging level 1039
>>
>> [2020/05/26 10:37:29:1091] I: Libwebsockets version:
>>
>> 4.0.99-v4.0.0-134-g3d04cdcd v4.0.0-134-g3d04cdcd
>>
>> [2020/05/26 10:37:29:1091] I: IPV6 not compiled in
>>
>> [2020/05/26 10:37:29:1091] I:  LWS_DEF_HEADER_LEN    : 4096
>>
>> [2020/05/26 10:37:29:1247] I:  LWS_MAX_SMP           : 1
>>
>> [2020/05/26 10:37:29:1247] I:  sizeof (*info)        : 704
>>
>> [2020/05/26 10:37:29:1247] I:  SYSTEM_RANDOM_FILEPATH: '/dev/urandom'
>>
>> [2020/05/26 10:37:29:1247] I:  HTTP2 support         : available
>>
>> [2020/05/26 10:37:29:1247] I: context created
>>
>> [2020/05/26 10:37:29:1247] I: Using event loop: poll
>>
>> [2020/05/26 10:37:29:1247] I: Default ALPN advertisment: h2,http/1.1
>>
>> [2020/05/26 10:37:29:1403] I:  default timeout (secs): 5
>>
>> [2020/05/26 10:37:29:1403] I:  Threads: 1 each 5 fds
>>
>> [2020/05/26 10:37:29:1403] I:  mem: context:          6104 B (2008 ctx
>> +
>>
>> (1 thr x 4096))
>>
>> [2020/05/26 10:37:29:1403] I:  mem: http hdr size:   (4096 + 976), max
>>
>> count 5
>>
>> [2020/05/26 10:37:29:1403] I:  mem: pollfd map:         80 B
>>
>> [2020/05/26 10:37:29:1403] I:  Compiled with OpenSSL support
>>
>> [2020/05/26 10:37:29:1560] I: Doing SSL library init
>>
>> [2020/05/26 10:37:29:1560] I:  canonical_hostname = win10
>>
>> [2020/05/26 10:37:29:1560] I: Creating Vhost 'default' (serving
>> disabled), 5 protocols, IPv6 off
>>
>> [2020/05/26 10:37:29:1717] I: lws_tls_client_create_vhost_context: vh
>>
>> default: created new client ctx 0
>>
>> [2020/05/26 10:37:29:2028] I: created client ssl context for default
>>
>> [2020/05/26 10:37:29:2028] I:  mem: per-conn:          824 bytes +
>>
>> protocol rx buf
>>
>> [2020/05/26 10:37:29:2185] I: lws_cancel_service
>>
>> [2020/05/26 10:37:29:2341] I: lws_state_notify_protocol_init:
>>
>> LWS_SYSTATE_CPD_PRE_TIME
>>
>> [2020/05/26 10:37:29:2341] I: lws_ss_create: unknown stream type
>> captive_portal_detect
>>
>> [2020/05/26 10:37:29:2341] I: lws_ss_sys_cpd: Create stream failed
>> (policy?)
>>
>> [2020/05/26 10:37:29:2341] I: lws_state_notify_protocol_init:
>>
>> LWS_SYSTATE_CPD_PRE_TIME
>>
>> [2020/05/26 10:37:29:2341] I: lws_ss_create: unknown stream type
>> captive_portal_detect
>>
>> [2020/05/26 10:37:29:2497] I: lws_ss_sys_cpd: Create stream failed
>> (policy?)
>>
>> [2020/05/26 10:37:29:2497] I: lws_state_notify_protocol_init: doing
>> protocol init on POLICY_VALID
>>
>> [2020/05/26 10:37:29:2497] I: lws_protocol_init
>>
>> [2020/05/26 10:37:29:2497] I: system_notify_cb: operational
>>
>> [2020/05/26 10:37:29:2497] I: lws_client_connect_via_info: role
>> binding to h1
>>
>> [2020/05/26 10:37:29:2497] I: lws_client_connect_via_info: protocol
>> binding to http
>>
>> [2020/05/26 10:37:29:2657] I: lws_client_connect_via_info: wsi
>>
>> 000001EFE3B3A520: h1 http entry
>>
>> [2020/05/26 10:37:29:2657] I: lws_header_table_attach: wsi
>>
>> 000001EFE3B3A520: ah 0000000000000000 (tsi 0, count = 0) in
>>
>> [2020/05/26 10:37:29:2657] I: _lws_create_ah: created ah
>>
>> 000001EFE1D6A810 (size 4096): pool length 1
>>
>> [2020/05/26 10:37:29:2657] I: lws_header_table_attach: did attach wsi
>>
>> 000001EFE3B3A520: ah 000001EFE1D6A810: count 1 (on exit)
>>
>> [2020/05/26 10:37:29:2809] I: lws_client_connect_2_dnsreq: adding
>> active conn 000001EFE3B3A520
>>
>> [2020/05/26 10:37:29:2809] I: lws_client_connect_2_dnsreq:
>>
>> 000001EFE3B3A520: lookup 46.105.127.147:443
>>
>> [2020/05/26 10:37:29:2809] I: lws_getaddrinfo46: getaddrinfo
>> '46.105.127.147' says 0
>>
>> [2020/05/26 10:37:29:2809] I: lws_client_connect_3_connect:
>>
>> 46.105.127.147 ipv4 46.105.127.147
>>
>> [2020/05/26 10:37:29:2966] I: lws_state_transition_steps:
>>
>> CONTEXT_CREATED -> OPERATIONAL
>>
>> [2020/05/26 10:37:29:2966] I: lws_client_connect_3_connect: errno 0
>>
>> [2020/05/26 10:37:29:3122] I: lws_client_connect_3_connect: Connection
>> started 000001EFE3AF20D0
>>
>> [2020/05/26 10:37:29:3122] I: lws_client_connect_4_established: wsi
>>
>> 000001EFE3B3A520: h1 http client created own conn (raw 0) vh defaultm
>> st
>>
>> 0x202
>>
>> [2020/05/26 10:37:29:3122] I: h1 client conn using alpn list 'h2'
>>
>> [2020/05/26 10:37:29:3434] I: lws_role_call_alpn_negotiated: 'h2'
>>
>> [2020/05/26 10:37:29:3434] I: rops_alpn_negotiated_h2: upgraded to H2
>>
>> [2020/05/26 10:37:29:3590] I: lws_hpack_dynamic_size: from 0 to 65536,
>> lim 65536 ...
>>
>>> I have update the code. Using git pull and resolve confict. As your said "git fetch xxx +master:m " Because this way in my company it will failed. I have to use git pull and resolve confict, so git hash is different.  But I make sure I have merge your code.
>>
>> Hmm doing this stuff with one person over different platforms is
>> really hard already.
>>
>> If your company blocks git fetch (but not pull? how?) that's your
>> problem not mine.  I don't want to burn myself out running around
>> after phantom bugs created by merge breakage because of some Great
>> Firewall of Huawei.
>>
>> Re-clone it or do something else that doesn't dump the time wasting
>> back on me and directly uses my commits.
>>
>> -Andy
>>
>>>
>>
>>> -----邮件原件-----
>>
>>> 发件人: Andy Green [mailto:andy at warmcat.com]
>>
>>> 发送时间: 2020年5月26日17:22
>>
>>> 收件人: huangkaicheng <huangkaicheng at huawei.com
>> <mailto:huangkaicheng at huawei.com>>; libwebsockets
>>
>>> <libwebsockets at ml.libwebsockets.org
>> <mailto:libwebsockets at ml.libwebsockets.org>>
>>
>>> 主题: Re: 答复: [Libwebsockets] 答复: 回复: 答复: A question about
>> libwebsockets
>>
>>> dns resolve
>>
>>>
>>
>>>
>>
>>>
>>
>>> On 5/26/20 10:14 AM, huangkaicheng wrote:
>>
>>>> Can you connect success in windows for ws client. The latest of
>>
>>>> master can not connect success. The latest code it will wait connect
>>
>>>> util timeout like(5.5.5.5 ).But if serverip is a reachable ip, it
>>>> can
>>
>>>> not connect success now.
>>
>>>>
>>
>>>> It is my test ws server(100.95.128.76  not public address) that ws
>>
>>>> client should connect success . but now it can not . Can you try it
>>
>>>> to connect your ws server successfully in windows? Last version it
>>
>>>> can connect success.
>>
>>>
>>
>>> Yes it connects fine.
>>
>>>
>>
>>>     >bin\Debug\lws-minimal-http-client.exe --server
>>
>>> junk.bogus.warmcat.com -m -d1039
>>
>>> [2020/05/26 10:20:53:2653] U: LWS minimal http client [-d<verbosity>]
>>
>>> [-l] [--h1]
>>
>>> [2020/05/26 10:20:53:2809] I: Initial logging level 1039
>>
>>> [2020/05/26 10:20:53:2809] I: Libwebsockets version:
>>
>>> 4.0.99-v4.0.0-134-g3d04cdcd v4.0.0-134-g3d04cdcd
>>
>>> [2020/05/26 10:20:53:2809] I: IPV6 not compiled in
>>
>>> [2020/05/26 10:20:53:2809] I:  LWS_DEF_HEADER_LEN    : 4096
>>
>>> [2020/05/26 10:20:53:2809] I:  LWS_MAX_SMP           : 1
>>
>>> [2020/05/26 10:20:53:2965] I:  sizeof (*info)        : 704
>>
>>> [2020/05/26 10:20:53:2965] I:  SYSTEM_RANDOM_FILEPATH: '/dev/urandom'
>>
>>> [2020/05/26 10:20:53:2965] I:  HTTP2 support         : available
>>
>>> [2020/05/26 10:20:53:2965] I: context created
>>
>>> [2020/05/26 10:20:53:2965] I: Using event loop: poll
>>
>>> [2020/05/26 10:20:53:2965] I: Default ALPN advertisment: h2,http/1.1
>>
>>> [2020/05/26 10:20:53:3123] I:  default timeout (secs): 5
>>
>>> [2020/05/26 10:20:53:3123] I:  Threads: 1 each 5 fds
>>
>>> [2020/05/26 10:20:53:3123] I:  mem: context:          6104 B (2008
>>> ctx +
>>
>>> (1 thr x 4096))
>>
>>> [2020/05/26 10:20:53:3123] I:  mem: http hdr size:   (4096 + 976),
>>> max
>>
>>> count 5
>>
>>> [2020/05/26 10:20:53:3123] I:  mem: pollfd map:         80 B
>>
>>> [2020/05/26 10:20:53:3123] I:  Compiled with OpenSSL support
>>
>>> [2020/05/26 10:20:53:3123] I: Doing SSL library init
>>
>>> [2020/05/26 10:20:53:3278] I:  canonical_hostname = win10
>>
>>> [2020/05/26 10:20:53:3278] I: Creating Vhost 'default' (serving
>>
>>> disabled), 5 protocols, IPv6 off
>>
>>> [2020/05/26 10:20:53:3434] I: lws_tls_client_create_vhost_context: vh
>>
>>> default: created new client ctx 0
>>
>>> [2020/05/26 10:20:53:3747] I: created client ssl context for default
>>
>>> [2020/05/26 10:20:53:3747] I:  mem: per-conn:          824 bytes +
>>
>>> protocol rx buf
>>
>>> [2020/05/26 10:20:53:3747] I: lws_cancel_service
>>
>>> [2020/05/26 10:20:53:3903] I: lws_state_notify_protocol_init:
>>
>>> LWS_SYSTATE_CPD_PRE_TIME
>>
>>> [2020/05/26 10:20:53:3903] I: lws_ss_create: unknown stream type
>>
>>> captive_portal_detect
>>
>>> [2020/05/26 10:20:53:3903] I: lws_ss_sys_cpd: Create stream failed
>>
>>> (policy?)
>>
>>> [2020/05/26 10:20:53:4060] I: lws_state_notify_protocol_init:
>>
>>> LWS_SYSTATE_CPD_PRE_TIME
>>
>>> [2020/05/26 10:20:53:4060] I: lws_ss_create: unknown stream type
>>
>>> captive_portal_detect
>>
>>> [2020/05/26 10:20:53:4060] I: lws_ss_sys_cpd: Create stream failed
>>
>>> (policy?)
>>
>>> [2020/05/26 10:20:53:4060] I: lws_state_notify_protocol_init: doing
>>
>>> protocol init on POLICY_VALID
>>
>>> [2020/05/26 10:20:53:4060] I: lws_protocol_init
>>
>>> [2020/05/26 10:20:53:4216] I: system_notify_cb: operational
>>
>>> [2020/05/26 10:20:53:4216] I: lws_client_connect_via_info: role
>>
>>> binding to h1
>>
>>> [2020/05/26 10:20:53:4216] I: lws_client_connect_via_info: protocol
>>
>>> binding to http
>>
>>> [2020/05/26 10:20:53:4216] I: lws_client_connect_via_info: wsi
>>
>>> 0000024D51E86C20: h1 http entry
>>
>>> [2020/05/26 10:20:53:4216] I: lws_header_table_attach: wsi
>>
>>> 0000024D51E86C20: ah 0000000000000000 (tsi 0, count = 0) in
>>
>>> [2020/05/26 10:20:53:4372] I: _lws_create_ah: created ah
>>
>>> 0000024D51DB1160 (size 4096): pool length 1
>>
>>> [2020/05/26 10:20:53:4372] I: lws_header_table_attach: did attach wsi
>>
>>> 0000024D51E86C20: ah 0000024D51DB1160: count 1 (on exit)
>>
>>> [2020/05/26 10:20:53:4372] I: lws_client_connect_2_dnsreq: adding
>>
>>> active conn 0000024D51E86C20
>>
>>> [2020/05/26 10:20:53:4372] I: lws_client_connect_2_dnsreq:
>>
>>> 0000024D51E86C20: lookup junk.bogus.warmcat.com:443
>>
>>> [2020/05/26 10:20:53:4531] I: lws_getaddrinfo46: getaddrinfo
>>
>>> 'junk.bogus.warmcat.com' says 0
>>
>>> [2020/05/26 10:20:53:4531] I: lws_client_connect_3_connect:
>>
>>> junk.bogus.warmcat.com ipv4 5.5.5.5
>>
>>> [2020/05/26 10:20:53:4531] I: lws_state_transition_steps:
>>
>>> CONTEXT_CREATED -> OPERATIONAL
>>
>>> [2020/05/26 10:20:53:4531] I: lws_client_connect_3_connect: errno 0
>>
>>> [2020/05/26 10:20:58:4685] I: lws_client_conn_wait_timeout: connect
>>
>>> wait timeout has fired
>>
>>> [2020/05/26 10:20:58:4685] I: lws_client_connect_3_connect:
>>> abandoning
>>
>>> connect due to timeout
>>
>>> [2020/05/26 10:20:58:4685] I: lws_client_connect_3_connect: (null)
>>
>>> ipv4
>>
>>> 10.99.99.99
>>
>>> [2020/05/26 10:20:58:4685] I: lws_client_connect_3_connect: errno 0
>>
>>> [2020/05/26 10:21:03:4692] I: lws_client_conn_wait_timeout: connect
>>
>>> wait timeout has fired
>>
>>> [2020/05/26 10:21:03:4692] I: lws_client_connect_3_connect:
>>> abandoning
>>
>>> connect due to timeout
>>
>>> [2020/05/26 10:21:03:4692] I: lws_client_connect_3_connect: (null)
>>
>>> ipv4
>>
>>> 46.105.127.147
>>
>>> [2020/05/26 10:21:03:4692] I: lws_client_connect_3_connect: errno 0
>>
>>> [2020/05/26 10:21:03:4841] I: lws_client_connect_3_connect:
>>> Connection
>>
>>> started 0000024D51FCD3A0
>>
>>> [2020/05/26 10:21:03:4997] I: lws_client_connect_4_established: wsi
>>
>>> 0000024D51E86C20: h1 http client created own conn (raw 0) vh defaultm
>>
>>> st
>>
>>> 0x202
>>
>>> [2020/05/26 10:21:03:4997] I: h1 client conn using alpn list 'h2'
>>
>>> [2020/05/26 10:21:03:5310] I: lws_role_call_alpn_negotiated: 'h2'
>>
>>> [2020/05/26 10:21:03:5310] I: rops_alpn_negotiated_h2: upgraded to H2
>>
>>> [2020/05/26 10:21:03:5310] I: lws_hpack_dynamic_size: from 0 to
>>> 65536,
>>
>>> lim 65536
>>
>>> [2020/05/26 10:21:03:5310] I: rops_alpn_negotiated_h2: wsi
>>
>>> 0000024D51E86C20: configured for h2
>>
>>> [2020/05/26 10:21:03:5310] I: client connect OK
>>
>>> [2020/05/26 10:21:03:5466] I: lws_openssl_describe_cipher: wsi
>>
>>> 0000024D51E86C20: TLS_AES_256_GCM_SHA384, TLS_AES_256_GCM_SHA384, 256
>>
>>> bits, TLSv1.3
>>
>>> [2020/05/26 10:21:03:5466] I: negotiated 'h2' using ALPN
>>
>>> [2020/05/26 10:21:03:5466] I: lws_role_call_alpn_negotiated: 'h2'
>>
>>> ...
>>
>>>
>>
>>>     From the git hash in your log, it doesn't look like you have the
>>
>>> latest master, it is
>>
>>>
>>
>>> e0c0007f3110efe2437b869ac4c312e04945dff7
>>
>>>
>>
>>> at the moment.
>>
>>>
>>
>>> -Andy
>>
>>>
>>
>>>> -----邮件原件-----
>>
>>>> 发件人: Andy Green [mailto:andy at warmcat.com]
>>
>>>> 发送时间: 2020年5月26日16:17
>>
>>>> 收件人: huangkaicheng <huangkaicheng at huawei.com
>> <mailto:huangkaicheng at huawei.com>>; libwebsockets
>>
>>>> <libwebsockets at ml.libwebsockets.org
>> <mailto:libwebsockets at ml.libwebsockets.org>>
>>
>>>> 抄送: Chenyake <chenyake at huawei.com <mailto:chenyake at huawei.com>>
>>
>>>> 主题: Re: [Libwebsockets] 答复: 回复: 答复: A question about libwebsockets
>>
>>>> dns resolve
>>
>>>>
>>
>>>> On 5/26/20 4:16 AM, andy at warmcat.com <mailto:andy at warmcat.com> <mailto:andy at warmcat.com> wrote:
>>
>>>>
>>
>>>>>
>>
>>>>
>>
>>>>>
>>
>>>>
>>
>>>>> On May 26, 2020 3:05:51 AM UTC, huangkaicheng
>>>>> <huangkaicheng at huawei.com <mailto:huangkaicheng at huawei.com
>> <mailto:huangkaicheng at huawei.com%20%3cmailto:huangkaicheng at huawei.com>
>>>>
>> wrote:
>>
>>>>
>>
>>>>>> Can you change "onevalid.bogus.warmcat.com"second and later ip
>>
>>>>
>>
>>>>>> 127.0.0.x to real ip (like 10.173.16.193(unreachable is also OK))
>>
>>>>>> for
>>
>>>>
>>
>>>>>
>>
>>>>
>>
>>>>> I also have blackhole.bogus.warmcat.com that is already 5.5.5.5 and the correct address, and test with that.
>>
>>>>
>>
>>>>>
>>
>>>>
>>
>>>>>> testing. I can not change your dns setting. Latest code
>>
>>>>>> libwebsockets
>>
>>>>
>>
>>>>>> doesnot still work. Second Ip (and later ip)does still not try wait.
>>
>>>>
>>
>>>>>> Only first Ip can try wait util time out. Old version will try
>>
>>>>
>>
>>>>>> indeed(last week). You can just change ip and test , you can
>>
>>>>
>>
>>>>>> reproduce it. Old version will try util time out but lastest code
>>
>>>>>> of
>>
>>>>
>>
>>>>>> master will not.
>>
>>>>
>>
>>>>>
>>
>>>>
>>
>>>>> We're going around in circles because I can't get windows to do
>>
>>>>> anything other than just use the correct address first.On linux
>>
>>>>> each time I run the test it rotates the dns results to start at a
>>
>>>>> different place,  so by running it a few times I can see the
>>
>>>>> different behaviours.On
>>
>>>> windows it connects to the server every time.
>>
>>>>
>>
>>>>>
>>
>>>>
>>
>>>>> I'll try adding more junk in a new bogus.warmcat.com record and see what happens.
>>
>>>>
>>
>>>> I trimmed the entries in each bogus record to 3 so with the default
>>
>>>> 5s wait / 20s overall it cam always complete, and added two new ones 'junk'
>>
>>>>
>>
>>>> and 'revjunk'
>>
>>>>
>>
>>>> onevalid.bogusINA127.0.0.1
>>
>>>>
>>
>>>>    INA127.0.0.2
>>
>>>>
>>
>>>>    INA46.105.127.147
>>
>>>>
>>
>>>> blackhole.bogusINA5.5.5.5
>>
>>>>
>>
>>>>    INA5.5.5.5
>>
>>>>
>>
>>>>    INA46.105.127.147
>>
>>>>
>>
>>>> junk.bogusINA10.99.99.99
>>
>>>>
>>
>>>>    INA5.5.5.5
>>
>>>>
>>
>>>>    INA46.105.127.147
>>
>>>>
>>
>>>> revjunk.bogusINA46.105.127.147
>>
>>>>
>>
>>>>    INA5.5.5.5
>>
>>>>
>>
>>>>    INA10.99.99.98
>>
>>>>
>>
>>>> With Linux, you get a different ordering of the results each time,
>>
>>>> and, on Linux, using what's in git from yesterday...
>>
>>>>
>>
>>>> [2020/05/26 04:40:17:6377] I: lws_client_connect_2_dnsreq: 0x2278440:
>>
>>>>
>>
>>>> lookup junk.bogus.warmcat.com:443
>>
>>>>
>>
>>>> [2020/05/26 04:40:17:6395] I: lws_getaddrinfo46: getaddrinfo
>>
>>>> 'junk.bogus.warmcat.com' says 0
>>
>>>>
>>
>>>> [2020/05/26 04:40:17:6395] I: lws_client_connect_3_connect:
>>
>>>>
>>
>>>> junk.bogus.warmcat.com ipv4 5.5.5.6
>>
>>>>
>>
>>>> [2020/05/26 04:40:17:6396] I: lws_state_transition_steps:
>>
>>>>
>>
>>>> CONTEXT_CREATED -> OPERATIONAL
>>
>>>>
>>
>>>> [2020/05/26 04:40:22:6397] I: lws_client_conn_wait_timeout: connect
>>
>>>> wait timeout has fired
>>
>>>>
>>
>>>> [2020/05/26 04:40:22:6398] I: lws_client_connect_3_connect:
>>
>>>> abandoning connect due to timeout
>>
>>>>
>>
>>>> [2020/05/26 04:40:22:6398] I: lws_client_connect_3_connect: (null)
>>
>>>> ipv4
>>
>>>>
>>
>>>> 5.5.5.5
>>
>>>>
>>
>>>> [2020/05/26 04:40:27:6401] I: lws_client_conn_wait_timeout: connect
>>
>>>> wait timeout has fired
>>
>>>>
>>
>>>> [2020/05/26 04:40:27:6402] I: lws_client_connect_3_connect:
>>
>>>> abandoning connect due to timeout
>>
>>>>
>>
>>>> [2020/05/26 04:40:27:6402] I: lws_client_connect_3_connect: (null)
>>
>>>> ipv4
>>
>>>>
>>
>>>> 46.105.127.147
>>
>>>>
>>
>>>> [2020/05/26 04:40:27:6584] I: lws_client_connect_3_connect:
>>
>>>> getsockopt
>>
>>>>
>>
>>>> check: conn OK
>>
>>>>
>>
>>>> [2020/05/26 04:40:27:6585] I: lws_client_connect_3_connect:
>>
>>>> Connection started 0x2299660
>>
>>>>
>>
>>>> ie, it is doing what it is supposed to do.When you say, without
>>
>>>> qualification
>>
>>>>
>>
>>>>>>   Latest code libwebsockets
>>
>>>>
>>
>>>>>> does not still work. Second Ip (and later ip)does still not try wait.
>>
>>>>
>>
>>>> this is adding to the confusion... it works fine on Linux.And it
>>
>>>> worked fine there before yesterday's patch, which at least as far as
>>
>>>> separating out the timeout control is also moving things forward in
>>
>>>> the right direction.
>>
>>>>
>>
>>>> On Windows, I though I had figured out that its libc api always
>>
>>>> reports the DNS in reverse order to the record, ie, the last
>>>> response
>>
>>>> in the record is the first reported one.That is why on my existing
>>
>>>> DNS test records, windows always magically "found" the correct
>>>> server
>>
>>>> first so I could not test the bad responses.But it seems whatever
>>
>>>> it's doing is more complicated, with 4 x test subdomains I could
>>
>>>> usually get one of them to try the bad ones first and test it though.
>>
>>>>
>>
>>>> I think I solved the problem and again updated the original patch,
>>
>>>> please give master a try.
>>
>>>>
>>
>>>> -Andy
>>
>>>>
>>
>>>>> -Andy
>>
>>>>
>>
>>>>>
>>
>>>>
>>
>>>>>>     
>>
>>>>
>>
>>>>>> -----邮件原件-----
>>
>>>>
>>
>>>>>> 发件人: andy at warmcat.com <mailto:andy at warmcat.com>
>> <mailto:andy at warmcat.com>
>>
>>>>>> [mailto:andy at warmcat.com]
>>
>>>>
>>
>>>>>> 发送时间: 2020年5月26日3:17
>>
>>>>
>>
>>>>>> 收件人: huangkaicheng <huangkaicheng at huawei.com
>>
>>>> <mailto:huangkaicheng at huawei.com>>; libwebsockets
>>
>>>>
>>
>>>>>> <libwebsockets at ml.libwebsockets.org
>>
>>>> <mailto:libwebsockets at ml.libwebsockets.org>>
>>
>>>>
>>
>>>>>> 抄送: Chenyake <chenyake at huawei.com <mailto:chenyake at huawei.com
>> <mailto:chenyake at huawei.com%20%3cmailto:chenyake at huawei.com>>>
>>
>>>>
>>
>>>>>> 主题: Re: 回复:[Libwebsockets] 答复: A question about libwebsockets dns
>>
>>>>
>>
>>>>>> resolve
>>
>>>>
>>
>>>>>>
>>
>>>>
>>
>>>>>>
>>
>>>>
>>
>>>>>>
>>
>>>>
>>
>>>>>> On May 25, 2020 11:04:00 AM UTC, huangkaicheng
>>
>>>>
>>
>>>>>> <huangkaicheng at huawei.com <mailto:huangkaicheng at huawei.com
>> <mailto:huangkaicheng at huawei.com%20%3cmailto:huangkaicheng at huawei.com>
>>>>
>> wrote:
>>
>>>>
>>
>>>>>>> Hi,
>>
>>>>
>>
>>>>>>> I mean that the first resolved ip, it can wait connect until time out.
>>
>>>>
>>
>>>>>>> And but second,third,and other it will not. It is not just 127.0.x.
>>
>>>>
>>
>>>>>> you
>>
>>>>
>>
>>>>>>> can change to make sure (onevalid.bogus.warmcat.com) dns resolve
>>
>>>>
>>
>>>>>>> like (46.105.127.147(only can reach) , 2.3.5.4, 10.173.16.193,5.45.86.4).
>>
>>>>
>>
>>>>>>> other Ip(unreachable it should wait connect util time out ).in
>>
>>>>>>> last
>>
>>>>
>>
>>>>>> old
>>
>>>>
>>
>>>>>>> version(a week ago), it will wait some time rather than finish
>>
>>>>
>>
>>>>>> quickly.
>>
>>>>
>>
>>>>>>> It is quite different with last version(a week ago).
>>
>>>>
>>
>>>>>>
>>
>>>>
>>
>>>>>> I looked at this earlier and pushed a patch adding a separate
>>
>>>>
>>
>>>>>> configurable timeout for the whole connect (default 20s) and
>>
>>>>>> reduced
>>
>>>>
>>
>>>>>> the timeout for individual dns connect attempts to default to 5s.
>>
>>>>
>>
>>>>>>
>>
>>>>
>>
>>>>>> https://libwebsockets.org/git/libwebsockets/commit?id=9f4c19fd9d9d
>>>>>> e
>>
>>>>>> d
>>
>>>>>> e
>>
>>>>
>>
>>>>>> 1ec856ce4774d46cb4b79b26c
>>
>>>>
>>
>>>>>>
>>
>>>>
>>
>>>>>> It seems to work as before on Linux, on windows I cannot control
>>
>>>>>> the
>>
>>>>
>>
>>>>>> dns ordering, both my test dns records 'just work' each time for
>>
>>>>
>>
>>>>>> whatever reason, 127.xxx is never tried.
>>
>>>>
>>
>>>>>>
>>
>>>>
>>
>>>>>> -Andy
>>
>>>>
>>
>>>>>>
>>
>>>>
>>
>>>>>>>
>>
>>>>
>>
>>>>>>> -----邮件原件-----
>>
>>>>
>>
>>>>>>> 发件人: Andy Green [mailto:andy at warmcat.com]
>>
>>>>
>>
>>>>>>> 发送时间: 2020年5月25日17:03
>>
>>>>
>>
>>>>>>> 收件人: huangkaicheng <huangkaicheng at huawei.com
>>
>>>> <mailto:huangkaicheng at huawei.com>>; libwebsockets
>>
>>>>
>>
>>>>>>> <libwebsockets at ml.libwebsockets.org
>>
>>>> <mailto:libwebsockets at ml.libwebsockets.org>>
>>
>>>>
>>
>>>>>>> 抄送: Chenyake <chenyake at huawei.com <mailto:chenyake at huawei.com
>> <mailto:chenyake at huawei.com%20%3cmailto:chenyake at huawei.com>>>
>>
>>>>
>>
>>>>>>> 主题: Re: 回复:[Libwebsockets] 答复: A question about libwebsockets dns
>>
>>>>
>>
>>>>>>> resolve
>>
>>>>
>>
>>>>>>>
>>
>>>>
>>
>>>>>>>
>>
>>>>
>>
>>>>>>>
>>
>>>>
>>
>>>>>>> On 5/25/20 9:31 AM, huangkaicheng wrote:
>>
>>>>
>>
>>>>>>>> Hi ,
>>
>>>>
>>
>>>>>>>>
>>
>>>>
>>
>>>>>>>>      I use test-client project in websockes previous. And it is
>>
>>>>
>>
>>>>>>>> not
>>
>>>>
>>
>>>>>>
>>
>>>>
>>
>>>>>>>> my code. it is about your code in your project.
>>
>>>>
>>
>>>>>>>
>>
>>>>
>>
>>>>>>> OK, fair enough.
>>
>>>>
>>
>>>>>>>
>>
>>>>
>>
>>>>>>> But what I mean is please make it easy for me to reproduce your
>>
>>>>
>>
>>>>>>> problem, ie minimal example, if a diff, give me the diff, and
>>>>>>> give
>>
>>>>
>>
>>>>>>> me the commandline.Then I can know if I can spare a few minutes,
>>
>>>>>>> I
>>
>>>>
>>
>>>>>>> can stop what I am doing and look at it (and I know immediately
>>
>>>>>>> that
>>
>>>>
>>
>>>>>>> it is
>>
>>>>
>>
>>>>>>
>>
>>>>
>>
>>>>>>> about a minimal example, which makes me much more want to stop
>>>>>>> and
>>
>>>>
>>
>>>>>>> look).
>>
>>>>
>>
>>>>>>>
>>
>>>>
>>
>>>>>>> As Jaco says I am not sure if it just confuses the issue with the
>>
>>>>
>>
>>>>>>> "timedout" log.On some platforms, 127.0.0.x port closed acts
>>
>>>>>>> like
>>
>>>>
>>
>>>>>>> closed and send you a FIN, on other platforms (IIRC OSX) it acts
>>
>>>>
>>
>>>>>>> like it was DROPped and waits.If on windows platform it resets
>>
>>>>>>> the
>>
>>>>
>>
>>>>>>> connection, like on Linux, it will not wait around and just fail
>>
>>>>
>>
>>>>>>> immediately, the log may not reflect the reality of why it gave
>>>>>>> up
>>
>>>>
>>
>>>>>>> then, which is not ideal but not really a crisis.
>>
>>>>
>>
>>>>>>>
>>
>>>>
>>
>>>>>>> -Andy
>>
>>>>
>>
>>>>>>>
>>
>>>>
>>
>>>>>>>>
>>
>>>>
>>
>>>>>>> imap://andy@warmcat.com:993/fetch%3EUID%3E.INBOX%3E126618?header=
>>>>>>> q
>>
>>>>>>> u
>>
>>>>>>> o
>>
>>>>
>>
>>>>>>> teb ody&part=1.1.3&filename=image002.png
>>
>>>>
>>
>>>>>>>>
>>
>>>>
>>
>>>>>>>> mkdir build
>>
>>>>
>>
>>>>>>>>
>>
>>>>
>>
>>>>>>>> cd build
>>
>>>>
>>
>>>>>>>>
>>
>>>>
>>
>>>>>>>> cmake .. -DLWS_WITH_SSL=0
>>
>>>>
>>
>>>>>>>>
>>
>>>>
>>
>>>>>>>> cmake --build . --config DEBUG
>>
>>>>
>>
>>>>>>>>
>>
>>>>
>>
>>>>>>>>      And I use
>>
>>>>
>>
>>>>>>>>
>>
>>>>
>>
>>>>>>> imap://andy@warmcat.com:993/fetch%3EUID%3E.INBOX%3E126618?header=
>>>>>>> q
>>
>>>>>>> u
>>
>>>>>>> o
>>
>>>>
>>
>>>>>>> teb ody&part=1.1.2&filename=image001.png
>>
>>>>
>>
>>>>>>>>
>>
>>>>
>>
>>>>>>>>      If I want to use minimal-ws-client, how can I build it
>>
>>>>
>>
>>>>>>> success. I
>>
>>>>
>>
>>>>>>>> build it failed.
>>
>>>>
>>
>>>>>>>>
>>
>>>>
>>
>>>>>>>> -----邮件原件-----
>>
>>>>
>>
>>>>>>>> 发件人: Andy Green [mailto:andy at warmcat.com]
>>
>>>>
>>
>>>>>>>> 发送时间: 2020年5月25日15:50
>>
>>>>
>>
>>>>>>>> 收件人: huangkaicheng <huangkaicheng at huawei.com
>>
>>>> <mailto:huangkaicheng at huawei.com>>; libwebsockets
>>
>>>>
>>
>>>>>>>> <libwebsockets at ml.libwebsockets.org
>>
>>>> <mailto:libwebsockets at ml.libwebsockets.org>>
>>
>>>>
>>
>>>>>>>> 抄送: Chenyake <chenyake at huawei.com <mailto:chenyake at huawei.com
>> <mailto:chenyake at huawei.com%20%3cmailto:chenyake at huawei.com>>>
>>
>>>>
>>
>>>>>>>> 主题: Re: 回复:[Libwebsockets] 答复: A question about libwebsockets
>>>>>>>> dns
>>
>>>>
>>
>>>>>>>> resolve
>>
>>>>
>>
>>>>>>>>
>>
>>>>
>>
>>>>>>>> On 5/25/20 8:35 AM, huangkaicheng wrote:
>>
>>>>
>>
>>>>>>>>
>>
>>>>
>>
>>>>>>>>> Hi,
>>
>>>>
>>
>>>>>>>>
>>
>>>>
>>
>>>>>>>>>
>>
>>>>
>>
>>>>>>>>
>>
>>>>
>>
>>>>>>>>>   there is still something wrong with latest code. Why try to
>>
>>>>
>>
>>>>>>>>
>>
>>>>
>>
>>>>>>>>> connect 127.0.0.1, 127.0.0.3, 127.0.0.2 time out so quickly?
>>
>>>>
>>
>>>>>>>>
>>
>>>>
>>
>>>>>>>> Can you please show me this using the lws minimal examples
>>>>>>>> rather
>>
>>>>
>>
>>>>>>> than
>>
>>>>
>>
>>>>>>>> your code?That way I can try the same thing quickly and have
>>>>>>>> some
>>
>>>>
>>
>>>>>>>> reason to think we are looking at the same problem, and if I
>>
>>>>>>>> change
>>
>>>>
>>
>>>>>>>> something, that it solves the problem.
>>
>>>>
>>
>>>>>>>>
>>
>>>>
>>
>>>>>>>> -Andy
>>
>>>>
>>
>>>>>>>>
>>
>>>>
>>
>>>>> _______________________________________________
>>
>>>>
>>
>>>>> Libwebsockets mailing list
>>
>>>>
>>
>>>>> Libwebsockets at ml.libwebsockets.org
>> <mailto:Libwebsockets at ml.libwebsockets.org>
>>
>>>> <mailto:Libwebsockets at ml.libwebsockets.org>
>>
>>>>
>>
>>>>> https://libwebsockets.org/mailman/listinfo/libwebsockets
>>
>>>>
>>
>>>>>
>>
>>>>
>>


More information about the Libwebsockets mailing list