From 35db10eca1587163df459993e21c14ae7c2ee851 Mon Sep 17 00:00:00 2001 From: John Wiseman Date: Thu, 23 Nov 2023 08:00:12 +0000 Subject: [PATCH] 6.0.24.20 --- Bpq32.c | 3 ++- Versions.h | 4 ++-- WinRPR.c | 40 +++++++++++++++++++++++----------------- 3 files changed, 27 insertions(+), 20 deletions(-) diff --git a/Bpq32.c b/Bpq32.c index 6b088e6..f3e6c00 100644 --- a/Bpq32.c +++ b/Bpq32.c @@ -1199,7 +1199,8 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses // Fix some 63 port bugs in RigCOntrol (17) // Fix 63 port bug in Bridging (18) // Add FTDX10 Rigcontrol (19) -// Fix 64 bit bug in displaying INP3 Messages +// Fix 64 bit bug in displaying INP3 Messages (20) +// Improve restart of WinRPR TNC on remote host (21) #define CKernel diff --git a/Versions.h b/Versions.h index 82c68c4..29b6e9e 100644 --- a/Versions.h +++ b/Versions.h @@ -10,8 +10,8 @@ #endif -#define KVers 6,0,24,20 -#define KVerstring "6.0.24.20\0" +#define KVers 6,0,24,21 +#define KVerstring "6.0.24.21\0" #ifdef CKernel diff --git a/WinRPR.c b/WinRPR.c index 51c6983..03d81ac 100644 --- a/WinRPR.c +++ b/WinRPR.c @@ -106,6 +106,7 @@ int ConnecttoWinRPR(int port); BOOL KillOldTNC(char * Path); int KillTNC(struct TNCINFO * TNC); +void CountRestarts(struct TNCINFO * TNC); static BOOL RestartTNC(struct TNCINFO * TNC) { @@ -789,16 +790,15 @@ void * WinRPRExtInit(EXTPORTDATA * PortEntry) return ExtProc; } + if (TNC->AutoStartDelay == 0) + TNC->AutoStartDelay = 2000; + sprintf(msg,"WinRPR Host %s %d", TNC->HostName, htons(TNC->destaddr.sin_port)); WritetoConsoleLocal(msg); TNC->Port = port; TNC->Hardware = H_WINRPR; - if (TNC->ProgramPath) - TNC->WeStartedTNC = RestartTNC(TNC); - - // Set up DED addresses for streams for (Stream = 0; Stream <= MaxStreams; Stream++) @@ -887,6 +887,9 @@ void * WinRPRExtInit(EXTPORTDATA * PortEntry) TNC->WEB_MODE = zalloc(20); TNC->WEB_BUFFERS = zalloc(100); TNC->WEB_TRAFFIC = zalloc(100); + TNC->WEB_RESTARTTIME = zalloc(100); + TNC->WEB_RESTARTS = zalloc(100); + #ifndef LINBPQ @@ -1451,14 +1454,9 @@ VOID WinRPRThread(void * portptr) // can only check if running on local host TNC->PID = GetListeningPortsPID(TNC->destaddr.sin_port); + if (TNC->PID == 0) - { - TNC->CONNECTING = FALSE; - sprintf(TNC->WEB_COMMSSTATE, "Waiting for TNC"); - MySetWindowText(TNC->xIDC_COMMSSTATE, TNC->WEB_COMMSSTATE); - - return; // Not listening so no point trying to connect - } + goto TNCNotRunning; // Get the File Name in case we want to restart it. @@ -1480,17 +1478,25 @@ VOID WinRPRThread(void * portptr) } } } + goto TNCRunning; } #endif -// // If we started the TNC make sure it is still running. +TNCNotRunning: + + // Not running or can't check, restart if we have a path + + if (TNC->ProgramPath) + { + Consoleprintf("Trying to (re)start TNC %s", TNC->ProgramPath); -// if (!IsProcess(TNC->PID)) -// { -// RestartTNC(TNC); -// Sleep(3000); -// } + if (RestartTNC(TNC)) + CountRestarts(TNC); + + Sleep(TNC->AutoStartDelay); + } +TNCRunning: TNC->destaddr.sin_addr.s_addr = inet_addr(TNC->HostName); TNC->Datadestaddr.sin_addr.s_addr = inet_addr(TNC->HostName);