Skip to content

Commit

Permalink
Replace ntripServer/ClientRestart with ntripServer/ClientStop when ne…
Browse files Browse the repository at this point in the history
…tworkIsShuttingDown
  • Loading branch information
PaulZC committed Jun 7, 2024
1 parent cbdf890 commit af73bf3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
4 changes: 2 additions & 2 deletions Firmware/RTK_Surveyor/Network.ino
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ void networkStop(uint8_t networkType)
serverIndex = user - NETWORK_USER_NTRIP_SERVER;
if (settings.debugNetworkLayer)
systemPrintln("Network layer stopping NTRIP server");
ntripServerRestart(serverIndex);
ntripServerStop(serverIndex, true); // Note: was ntripServerRestart(serverIndex);
}
break;

Expand All @@ -899,7 +899,7 @@ void networkStop(uint8_t networkType)
case NETWORK_USER_NTRIP_CLIENT:
if (settings.debugNetworkLayer)
systemPrintln("Network layer stopping NTRIP client");
ntripClientRestart();
ntripClientStop(true); // Note: was ntripClientRestart();
break;

case NETWORK_USER_OTA_FIRMWARE_UPDATE:
Expand Down
8 changes: 4 additions & 4 deletions Firmware/RTK_Surveyor/NtripClient.ino
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ void ntripClientUpdate()
// Determine if the network has failed
if (networkIsShuttingDown(NETWORK_USER_NTRIP_CLIENT))
// Failed to connect to to the network, attempt to restart the network
ntripClientRestart();
ntripClientStop(true); // Note: was ntripClientRestart();

// Determine if the network is connected to the media
else if (networkUserConnected(NETWORK_USER_NTRIP_CLIENT))
Expand All @@ -607,7 +607,7 @@ void ntripClientUpdate()
// Determine if the network has failed
if (networkIsShuttingDown(NETWORK_USER_NTRIP_CLIENT))
// Failed to connect to to the network, attempt to restart the network
ntripClientRestart();
ntripClientStop(true); // Note: was ntripClientRestart();

// If GGA transmission is enabled, wait for GNSS lock before connecting to NTRIP Caster
// If GGA transmission is not enabled, start connecting to NTRIP Caster
Expand Down Expand Up @@ -640,7 +640,7 @@ void ntripClientUpdate()
// Determine if the network has failed
if (networkIsShuttingDown(NETWORK_USER_NTRIP_CLIENT))
// Failed to connect to to the network, attempt to restart the network
ntripClientRestart();
ntripClientStop(true); // Note: was ntripClientRestart();

// Check for no response from the caster service
else if (ntripClientReceiveDataAvailable() <
Expand Down Expand Up @@ -766,7 +766,7 @@ void ntripClientUpdate()
// Determine if the network has failed
if (networkIsShuttingDown(NETWORK_USER_NTRIP_CLIENT))
// Failed to connect to to the network, attempt to restart the network
ntripClientRestart();
ntripClientStop(true); // Note: was ntripClientRestart();

// Check for a broken connection
else if (!ntripClient->connected())
Expand Down
12 changes: 6 additions & 6 deletions Firmware/RTK_Surveyor/NtripServer.ino
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ void ntripServerUpdate(int serverIndex)
// Determine if the network has failed
if (networkIsShuttingDown(NETWORK_USER_NTRIP_SERVER + serverIndex))
// Failed to connect to to the network, attempt to restart the network
ntripServerRestart(serverIndex); // Should this be ntripServerStop? TODO
ntripServerStop(serverIndex, true); // Note: was ntripServerRestart(serverIndex);

// Determine if the network is connected to the media
else if (networkUserConnected(NETWORK_USER_NTRIP_SERVER + serverIndex))
Expand Down Expand Up @@ -645,7 +645,7 @@ void ntripServerUpdate(int serverIndex)
// Determine if the network has failed
if (networkIsShuttingDown(NETWORK_USER_NTRIP_SERVER + serverIndex))
// Failed to connect to to the network, attempt to restart the network
ntripServerRestart(serverIndex); // Should this be ntripServerStop? TODO
ntripServerStop(serverIndex, true); // Note: was ntripServerRestart(serverIndex);

else if (settings.enableNtripServer
&& (millis() - ntripServer->lastConnectionAttempt > ntripServer->connectionAttemptTimeout))
Expand All @@ -663,7 +663,7 @@ void ntripServerUpdate(int serverIndex)
// Determine if the network has failed
if (networkIsShuttingDown(NETWORK_USER_NTRIP_SERVER + serverIndex))
// Failed to connect to to the network, attempt to restart the network
ntripServerRestart(serverIndex); // Should this be ntripServerStop? TODO
ntripServerStop(serverIndex, true); // Note: was ntripServerRestart(serverIndex);

// State change handled in ntripServerProcessRTCM
break;
Expand All @@ -673,7 +673,7 @@ void ntripServerUpdate(int serverIndex)
// Determine if the network has failed
if (networkIsShuttingDown(NETWORK_USER_NTRIP_SERVER + serverIndex))
// Failed to connect to to the network, attempt to restart the network
ntripServerRestart(serverIndex); // Should this be ntripServerStop? TODO
ntripServerStop(serverIndex, true); // Note: was ntripServerRestart(serverIndex);

// Delay before opening the NTRIP server connection
else if ((millis() - ntripServer->timer) >= ntripServer->connectionAttemptTimeout)
Expand All @@ -699,7 +699,7 @@ void ntripServerUpdate(int serverIndex)
// Determine if the network has failed
if (networkIsShuttingDown(NETWORK_USER_NTRIP_SERVER + serverIndex))
// Failed to connect to to the network, attempt to restart the network
ntripServerRestart(serverIndex); // Should this be ntripServerStop? TODO
ntripServerStop(serverIndex, true); // Note: was ntripServerRestart(serverIndex);

// Check if caster service responded
else if (ntripServer->networkClient->available() < strlen("ICY 200 OK")) // Wait until at least a few bytes have arrived
Expand Down Expand Up @@ -785,7 +785,7 @@ void ntripServerUpdate(int serverIndex)
// Determine if the network has failed
if (networkIsShuttingDown(NETWORK_USER_NTRIP_SERVER + serverIndex))
// Failed to connect to to the network, attempt to restart the network
ntripServerRestart(serverIndex); // Should this be ntripServerStop? TODO
ntripServerStop(serverIndex, true); // Note: was ntripServerRestart(serverIndex);

// Check for a broken connection
else if (!ntripServer->networkClient->connected())
Expand Down

0 comments on commit af73bf3

Please sign in to comment.