g4klx / DAPNETGateway

Gateway to the DAPNET POCSAG network.
GNU General Public License v2.0
32 stars 22 forks source link

Service stops working when internet connection changes #10

Open dk5ras opened 6 years ago

dk5ras commented 6 years ago

Hi,

It appears that the service stops working when the internet connection is unstable or changes its IP address. MMDVMHost still works, DV operation is not affected, but DAPNET connection breaks. Restarting the dapnetgateway service fixes this.

Ralph, dk5ras.

dd5xl commented 6 years ago

I've put a log output into line 72 of DAPNETNetwork.cpp to see the error code while reading from a broken socket (router rebooted), but there is no negative error code from m_socket.read() at all when the server has been disconnected. So the recover() mechanism in DAPNETGateway.cpp is never executed, the Gateway just stops working.

dk5ras commented 6 years ago

As an update, the general stability appears better now, but still when the network changes (for example new IP address on the WAN side) the connection dies.

do6uk commented 6 years ago

This problem occurs also when core was restartet. The Gateway seems to work and does not notice broken connection to core and will not reconnect.

In Dapnet Core there is a Ping-Pong-Command to check connection - is this not implemented in Gateway?

do6uk commented 6 years ago

I'm not firm in cpp - is it possible to set an timeout in socket-read and send an ping-command to core. If failed - restart conn else go again to read from socket.

g4klx commented 6 years ago

I've added keepalives to the TCP connection to DAPNET. I hope that makes things better.