Skip to content

Commit 7937933

Browse files
committed
Fix ban logic for NTRIP Server
1 parent 18ad8f3 commit 7937933

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

Firmware/RTK_Surveyor/NtripServer.ino

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -684,6 +684,24 @@ void ntripServerUpdate()
684684
// Look for various responses
685685
if (strstr(response, "200") != nullptr) //'200' found
686686
{
687+
// We got a response, now check it for possible errors
688+
if (strcasestr(response, "banned") != nullptr)
689+
{
690+
systemPrintf("NTRIP Server connected to caster but caster responded with banned error: %s\r\n",
691+
response);
692+
693+
// Stop NTRIP Server operations
694+
ntripServerShutdown();
695+
}
696+
else if (strcasestr(response, "sandbox") != nullptr)
697+
{
698+
systemPrintf("NTRIP Server connected to caster but caster responded with sandbox error: %s\r\n",
699+
response);
700+
701+
// Stop NTRIP Server operations
702+
ntripServerShutdown();
703+
}
704+
687705
systemPrintf("NTRIP Server connected to %s:%d %s\r\n", settings.ntripServer_CasterHost,
688706
settings.ntripServer_CasterPort, settings.ntripServer_MountPoint);
689707

@@ -700,22 +718,13 @@ void ntripServerUpdate()
700718
else if (strstr(response, "401") != nullptr)
701719
{
702720
systemPrintf(
703-
"NTRIP Caster responded with bad news: %s. Are you sure your caster credentials are correct?\r\n",
721+
"NTRIP Caster responded with unauthorized error: %s. Are you sure your caster credentials are correct?\r\n",
704722
response);
705723

706724
// Give up - Shutdown NTRIP server, no further retries
707725
ntripServerShutdown();
708726
}
709727

710-
// Look for banned IP information
711-
else if (strstr(response, "banned") != nullptr) //'Banned' found
712-
{
713-
systemPrintf("NTRIP Server connected to caster but caster responded with problem: %s\r\n", response);
714-
715-
// Give up - Shutdown NTRIP server, no further retries
716-
ntripServerShutdown();
717-
}
718-
719728
// Other errors returned by the caster
720729
else
721730
{

0 commit comments

Comments
 (0)