[Libwebsockets] Is there a way to reuse a lws_context without destroying it

Andy Green andy at warmcat.com
Wed Jun 14 10:00:10 CEST 2017



On 06/14/2017 02:35 PM, Ash 20001 wrote:
> Is there a way to call lws_create_context just once for program lifetime 
> as a client, and use that context for many connections (ie. connect to a 
> server, disconnect, repeat)? I have tried but it doesn't seem to work on 
> the second connection.

Yes it should be fine.

Libwebsockets-test-client does exactly this in its normal operation.

What exactly happens (and does it happen on lws master?)

 > The reason I ask is because I am having SSL issues with other threads
 > that I have no control over in a process which use ssl functions in
 > CURL. lws_destroy_context globally destructs SSL state and causes
 > issues.  My openssl version is rather old 0.9.8 and cannot be changed.

Yeah.... we have seen it before.  Later openssl fixed it.

It will trash openssl for the whole process.  Is that why you can't get 
a second client connection in lws?

-Andy



> 
> Thanks!
> 
> (Sorry if I sent two emails, not sure if the first one went through 
> because I was trying to subscribe to the mailing list).
> 
> 
> 
> _______________________________________________
> Libwebsockets mailing list
> Libwebsockets at ml.libwebsockets.org
> https://libwebsockets.org/mailman/listinfo/libwebsockets
> 



More information about the Libwebsockets mailing list