[Libwebsockets] http client: seeing delayed SSL connection

Andy Green andy at warmcat.com
Wed Feb 22 02:27:39 CET 2017

On February 22, 2017 10:16:36 AM GMT+09:00, Joel Winarske <joel.winarske at gmail.com> wrote:
>Well I'm calling it a delay, but I suspect it's just the expected
>of the "service loop".  Given http client is not a single synchronous
>function call.

It depends what kind of delay, but name resolution takes network roundtrips as does establishing the tcp connection.  But those should be no different than say wget doing the same thing.

>The scenario is loading the "site".  Which is around 275 server
>requests on
>initial load.  Of which only the second occurring Method: POST
>is "refused"/or "pending".  I never see the incoming request in the

Hm if this is lws it sounds like keepalive pipelining probs.

>Chrome doesn't always report the transaction "refused".  Most of the

Mmm I dunno that is related at all to the canonical "Connection Refused" at tcp level.  It seems to feel an individual transaction was not processed.

>it says "pending", which in Wireshark - the server doesn't respond.  So
>pattern is every other POST '/rest/send', of which calls the http

If we ignore "Connection Refused", we know from your earlier log chrome is pipelining because it's logged when it handles the transaction complete.

Personally I never tried two back-back POSTs pipelined, and this encompasses the behaviour of your POST callbacks as well as lws itself.

Is there a way I can reproduce it without a big effort?


>On Tue, Feb 21, 2017 at 3:00 PM, Andy Green <andy at warmcat.com> wrote:
>> On February 22, 2017 7:46:12 AM GMT+09:00, Joel Winarske <
>> joel.winarske at gmail.com> wrote:
>> >lwsws on Windows, so libuv.
>> Right.
>> >Timing wise the refused request happens during
>> >lws_ssl_client_connect2().
>> If we believe it really is a "connection refused" specifically, and
>> something else that falls into the general category of "my connection
>> not accepted", it's more interesting to understand the state of the
>> part at that time.  We are spamming it with connections?  Something
>> >Also how do I get rid of the delay between
>> >and
>> >lws_ssl_client_connect2()?
>> ... what delay?
>> -Andy

More information about the Libwebsockets mailing list