From f1bf68a54506ec51bacdd27ef7eec6ac6732d629 Mon Sep 17 00:00:00 2001 From: John Wiseman Date: Mon, 3 Apr 2023 08:20:27 +0100 Subject: 6.0.23.58 --- WinRPR.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'WinRPR.c') diff --git a/WinRPR.c b/WinRPR.c index 25609c1..a7f22f1 100644 --- a/WinRPR.c +++ b/WinRPR.c @@ -39,6 +39,12 @@ extern int (WINAPI FAR *EnumProcessesPtr)(); #include "tncinfo.h" + +#define SD_RECEIVE 0x00 +#define SD_SEND 0x01 +#define SD_BOTH 0x02 + + //#include "bpq32.h" static char ClassName[]="TRACKERSTATUS"; @@ -106,6 +112,7 @@ VOID TrkExitHost(struct TNCINFO * TNC); int ConnecttoWinRPR(int port); BOOL KillOldTNC(char * Path); +int KillTNC(struct TNCINFO * TNC); static BOOL RestartTNC(struct TNCINFO * TNC) { @@ -605,12 +612,19 @@ ok: TrkExitHost(TNC); Sleep(50); - CloseCOMPort(TNC->hDevice); - TNC->hDevice =(HANDLE)0; TNC->ReopenTimer = 250; TNC->HostMode = FALSE; - return (0); + shutdown(TNC->TCPSock, SD_BOTH); + Sleep(100); + closesocket(TNC->TCPSock); + + if (TNC->WeStartedTNC) + { + KillTNC(TNC); + RestartTNC(TNC); + } + return 0; case 5: // Close @@ -620,7 +634,14 @@ ok: Sleep(25); - CloseCOMPort(TNC->hDevice); + shutdown(TNC->TCPSock, SD_BOTH); + Sleep(100); + closesocket(TNC->TCPSock); + if (TNC->WeStartedTNC) + KillTNC(TNC); + + + return (0); case 6: // Scan Interface -- cgit v1.2.3