[Libwebsockets] Possible bug, ping/pong with polling on Windows seems to send pings too late

Andy Green andy at warmcat.com
Thu Oct 8 16:16:37 CEST 2020



On 10/8/20 4:18 AM, Casey Banner wrote:

> Perhaps this is a problem specifically on windows with this polling model?

> I could also just use the scheduler to wake up and send pings (without
> using the retry functionality at all). Also, if I've misunderstood how
> the system is supposed to work, let me know.

No you seem to have the right ideas.

The fd event handling for windows platform is wrong, I pushed a patch 
aligning it to how events are used in the ms examples about it.  That 
has a lot of history, originally it was contributed and various people 
hacked on it, since then I have my own windows VM and run lws-based CI 
locally on it, so over the last 6 months or so windows support has 
improved a lot, since I use it myself.  It's just the event reporting 
causing wakes impacted, since there were hacks to make everything else 
work if something else was waking it.

WSA needs an event per fd, I added this, but it's limited to 64 events 
with one reserved for lws_cancel_service(), so 63 fds.  WSA basically 
does not know how to do POSIX POLLOUT, it reports an event when 
"blocking for write is no longer the case", not when you may write.  I 
added support for that with detection of blocking each time in the 
service code, since if we waited until we did the work to do the write, 
it's too late.

I confirmed the changes work with the minimal examples, 
lws_cancel_service etc, please give current lws master a try.  And it 
fixes a recent lws_cancel_service() related problem for 
lws-api-test-lws_smd on windows so CI is back to green again.

If you need more fds, look to libuv which is also supported and no doubt 
does a better job than the default roll-your-own implementation.

-Andy



More information about the Libwebsockets mailing list