lora-gateway / esxp1302

An 8-channel ESP32 LoRa Gateway based on SX1302
Other
33 stars 17 forks source link

Make networking independent from app #19

Open danielkucera opened 2 weeks ago

danielkucera commented 2 weeks ago

Hello, I'd like to make networking independent from the packet forwarder app. I see it happen in following steps:

The sockets for packet forwarder can be created even without working connection (as with the webserver). The only relevant parts are DNS resolving during connection (solved in wip) and sending status/uplink packets - this has to be tested how it behaves during missing connection (if it drops after start and resolving server) but IMO it should be fine - we should just ignore a potential error during UDP packet send. Once the connection reestablishes it should continue sending.

What do you think about this?

dennis4lora commented 2 weeks ago

@danielkucera

Thanks for this proposal, it paves the way to support multi types of network interface.

In fact, there is a problem in the original sx1302_hal: after pkt-fwd runs, if you disconnect the Ethernet cable then connect it again, pkt-fwd keeps run, but the packets won't be sent out to NS any more (I guess this is caused by how the sockets are created or configured but I didn't investigate).

I think esxp1302 pkt-fwd doesn't have this problem because: if Wi-Fi fails for a few seconds then re-connected, there is no logic to restart the pkt-fwd (I guess I tested this situation).

Of course, it needs careful thinking about the network state changes and some tests to make sure no mistake, but I think this idea is doable. :smile: