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

andy at warmcat.com andy at warmcat.com
Wed May 20 05:36:51 CEST 2020

On May 20, 2020 3:20:14 AM UTC, huangkaicheng <huangkaicheng at huawei.com> wrote:
>I know why because I set timeout 
>20 sec. and "schedule wait_time" out will not take effect. If it is
>in windows and linux will not?

The way I implemented this connect timeout was to reuse the wsi lws_sul that tracks timeout


"reuse" means I not only set the time, but direct it to use a different callback when it fires... after the connect if you set a wsi timeout it will also set the callback to handle a generic wsi timeout.  So while it's waiting for connect, setting some other wsi timeout is in conflict with this connect timeout detection stuff.

Why do you want to set an explicit wsi timeout on it when it already now takes care of setting the connect timeout itself?  You're trying to set an overall timeout including all retries?  If we want that, we need to move the individual connect timeouts lws manages to its own private lws_sul.


>    Huangkaicheng
>发件人: Andy Green [mailto:andy at warmcat.com] 
>发送时间: 2020年5月19日 23:09
>收件人: huangkaicheng <huangkaicheng at huawei.com>; libwebsockets
><libwebsockets at ml.libwebsockets.org>
>抄送: Chenyake <chenyake at huawei.com>
>主题: Re: 答复: 回复: [Libwebsockets] 答复: A question about libwebsockets dns
>On 5/19/20 3:40 PM, huangkaicheng wrote:
>> Hi ,
>>     In my mac pro , I found that schedule of wait does not take
>> and" lws_client_conn_wait_timeout"  does not trigger when it try to 
>> connect to “”. I have add some log for you. See more in 
>> attachment. I do not understand why”wait_timeout “is not trigger. And
>> I try it with “onevalid.bogus.warmcat.com”. please help to check why.
>Dunno... but... I can usually do something about my code if it has
>problems.  I can't do anything about your code.
>I can't reproduce your problem with my code (the minimal example), and
>I tried it on a real OSX machine as you described.
>Do you have the same problem on your machine if you put your code on
>one side, and try to repeat the exact same test I showed thismorning
>using my minimal example alone?  In other words, does it need your code
>to see the problem coming, or the problem exists without your code?
>Also if your test was supposed to be idle, because it's waiting for the
>connect, it seems to be awful busy going around the event loop.  In my
>test, the logs are completely idle while it waits for the connect

More information about the Libwebsockets mailing list