gotthardp / lorawan-server

Compact server for private LoRaWAN networks
https://gotthardp.github.io/lorawan-server
MIT License
956 stars 329 forks source link

PUSH ACK response time #227

Closed javierpedrido closed 6 years ago

javierpedrido commented 6 years ago

Hi

After upgrading to the latest code, I started seeing a lot of "ack_lost" warning messages. Then I realized that my gateway was not receiving any PUSH ACK from the server. It was a timeout problem, changing the packet forwarder parameter push_timeout_ms from 100 to 300 solved the problem. Looking at https://github.com/Lora-net/packet_forwarder/blob/master/PROTOCOL.TXT, it says that the server should send the ACK before processing the packet data. In lorawan_gw_forwarder.erl handle_info, the ACK is being sent after parsing the json object data, wouldn't be better to first send the ACK and then parse the json?

Best regards, Javier

gotthardp commented 6 years ago

Hello. I love your bug reports: always clear and always right. :) I just fixed it. Thank you!

javierpedrido commented 6 years ago

Thanks for the fix! :) Maybe the same thing should be done for the PULL ACK?

gotthardp commented 6 years ago

Yeah. Could be, but pull doesn't really do much, so the difference will be minimal.

javierpedrido commented 6 years ago

Yes, the code before the udp send is fast.

gotthardp commented 6 years ago

So I guess I can close this, right?

javierpedrido commented 6 years ago

Yes, thanks, it's working fine now with a 100 ms timeout.