arduino / nina-fw

Firmware for u-blox NINA W102 WiFi/BT module
135 stars 117 forks source link

support server.accept() for WiFiNINA library #79

Closed JAndrassy closed 2 years ago

JAndrassy commented 2 years ago

A PR in WiFiNINA library follows.

There are almost no comments in the fw source code so I didn't add any too. But it is not too complicated. The only catch is that CommandHandlerClass::updateGpio0Pin periodically calls server.available() which accepts clients for _spawnedSockets (available() and write-to-all clients management). A new function server.hasClient (inspired by the ESP32 core WiFi library's WiFiServer) is used to outrun available() in accepting a new client from updateGpio0Pin. If after IRQ pin is activated, the sketch calls accept(), the pre-accepted client is returned and not used for _spawnedSockets. If available() is called from sketch, then the pre-accepted socket is added to _spawnedSockets.

btw: WiFiServer::available() should be rewritten to only get new clients if there is a slot in _spawnedSockets.

JAndrassy commented 2 years ago

@facchinm please why not include this into the prerelease?

facchinm commented 2 years ago

Hi @JAndrassy , I'm going to prerelease this change in 1.5.1 as soon as 1.5.0 has rolled out safely; thanks for your effort!

xreef commented 12 months ago

Hi @JAndrassy , I'm going to prerelease this change in 1.5.1 as soon as 1.5.0 has rolled out safely; thanks for your effort!

Hi @facchinm, can you share the precompiled file? Isn't shared anywhere yet. Thanks