From d3c2c5dea894e999251ad725ab0fecdbefd6a7bd Mon Sep 17 00:00:00 2001 From: John Wiseman Date: Fri, 21 Feb 2025 13:21:07 +0000 Subject: [PATCH] 6.0.24.65 --- Bpq32.c | 5 ++++- CommonCode.c | 1 + RHP.c | 20 +++++++++++++------- TelnetV6.c | 4 ++++ Versions.h | 4 ++-- 5 files changed, 24 insertions(+), 10 deletions(-) diff --git a/Bpq32.c b/Bpq32.c index 3ddd5a7..944010b 100644 --- a/Bpq32.c +++ b/Bpq32.c @@ -1244,7 +1244,7 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses // Attempt to fix NC going to wrong application. (57) // Improve ARDOP end of session code (58) // Run M0LTE Map reporting in a separate thread (59/60) -// Add support for WhatsPac (59) +// Add RHP support for WhatsPac (59) // Add timestamps to LIS monitor (60) // Fix problem with L4 frames being delivered out of sequence (60) // Add Compression of Netrom connections (62) @@ -1252,6 +1252,9 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses // Add L4 RESET (Paula G8PZT's extension to NETROM) // Fix problem using SENDRAW from BPQMail (63) // Fix compatibility with latest ardopcf (64) +// Fix bug in RHP socket timeout code (65) + + #define CKernel #include "Versions.h" diff --git a/CommonCode.c b/CommonCode.c index e21cace..0866980 100644 --- a/CommonCode.c +++ b/CommonCode.c @@ -17,6 +17,7 @@ You should have received a copy of the GNU General Public License along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses */ + // General C Routines common to bpq32 and linbpq. Mainly moved from BPQ32.c #pragma data_seg("_BPQDATA") diff --git a/RHP.c b/RHP.c index 25182fc..18b933d 100644 --- a/RHP.c +++ b/RHP.c @@ -28,6 +28,7 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses #include "cheaders.h" #include "bpq32.h" +#include "telnetserver.h" int FindFreeStreamNoSem(); DllExport int APIENTRY DeallocateStream(int stream); @@ -40,6 +41,7 @@ static int GetJSONInt(char * _REPLYBUFFER, char * Name); struct RHPSessionInfo { + struct ConnectionInfo * sockptr; SOCKET Socket; // Websocks Socket int BPQStream; int Handle; // RHP session ID @@ -66,6 +68,7 @@ struct RHPParamBlock unsigned char * Msg; int Len; SOCKET Socket; + struct ConnectionInfo * sockptr; }; @@ -113,7 +116,7 @@ int WhatsPacConfigured = 1; int RHPPaclen = 236; -int processRHCPOpen(SOCKET Socket, char * Msg, char * ReplyBuffer); +int processRHCPOpen(struct ConnectionInfo * sockptr, SOCKET Socket, char * Msg, char * ReplyBuffer); int processRHCPSend(SOCKET Socket, char * Msg, char * ReplyBuffer); int processRHCPClose(SOCKET Socket, char * Msg, char * ReplyBuffer); int processRHCPStatus(SOCKET Socket, char * Msg, char * ReplyBuffer); @@ -129,7 +132,6 @@ void SendWebSockMessage(SOCKET socket, char * Msg, int Len) // WebSock Encode. Buffer has 10 bytes on front for header but header len depends on Msg len - if (Len < 126) { // Two Byte Header @@ -189,7 +191,7 @@ void SendWebSockMessage(SOCKET socket, char * Msg, int Len) return; } -void ProcessRHPWebSock(SOCKET Socket, char * Msg, int MsgLen); +void ProcessRHPWebSock(struct ConnectionInfo * sockptr, SOCKET Socket, char * Msg, int MsgLen); void RHPThread(void * Params) { @@ -197,7 +199,7 @@ void RHPThread(void * Params) struct RHPParamBlock * Block = (struct RHPParamBlock *)Params; - ProcessRHPWebSock(Block->Socket, Block->Msg, Block->Len); + ProcessRHPWebSock(Block->sockptr, Block->Socket, Block->Msg, Block->Len); free(Block->Msg); free(Params); @@ -209,7 +211,7 @@ int RHPProcessHTTPMessage(void * conn, char * response, char * Method, char * UR return 0; } -void ProcessRHPWebSock(SOCKET Socket, char * Msg, int MsgLen) +void ProcessRHPWebSock(struct ConnectionInfo * sockptr, SOCKET Socket, char * Msg, int MsgLen) { int Loops = 0; int InputLen = 0; @@ -278,7 +280,7 @@ void ProcessRHPWebSock(SOCKET Socket, char * Msg, int MsgLen) if (_stricmp(Value, "open") == 0) { - Len = processRHCPOpen(Socket, Msg, &OutBuffer[10]); // Space at front for WebSock Header + Len = processRHCPOpen(sockptr, Socket, Msg, &OutBuffer[10]); // Space at front for WebSock Header if (Len) SendWebSockMessage(Socket, OutBuffer, Len); return; @@ -351,7 +353,7 @@ void ProcessRHPWebSockClosed(SOCKET socket) -int processRHCPOpen(SOCKET Socket, char * Msg, char * ReplyBuffer) +int processRHCPOpen(struct ConnectionInfo * sockptr, SOCKET Socket, char * Msg, char * ReplyBuffer) { //{"type":"open","id":5,"pfam":"ax25","mode":"stream","port":"1","local":"G8BPQ","remote":"G8BPQ-2","flags":128} @@ -424,6 +426,7 @@ int processRHCPOpen(SOCKET Socket, char * Msg, char * ReplyBuffer) RHPSession->Handle = Handle; RHPSession->Connecting = TRUE; RHPSession->Socket = Socket; + RHPSession->sockptr = sockptr; strcpy(RHPSession->Local, Local); strcpy(RHPSession->Remote, Remote); @@ -632,6 +635,9 @@ void RHPPoll() Buffer[pktlen] = 0; + RHPSession->sockptr->LastSendTime = time(NULL); + + // Message is JSON so Convert CR to \r, \ to \\ " to \" // Looks like I need to escape everything not between 0x20 and 0x7f eg \U00c3 diff --git a/TelnetV6.c b/TelnetV6.c index 0bf5a51..287118b 100644 --- a/TelnetV6.c +++ b/TelnetV6.c @@ -4989,6 +4989,7 @@ struct RHPParamBlock unsigned char * Msg; int Len; SOCKET Socket; + struct ConnectionInfo * sockptr; }; @@ -5131,10 +5132,13 @@ int DataSocket_ReadHTTP(struct TNCINFO * TNC, struct ConnectionInfo * sockptr, S struct RHPParamBlock * ParamBlock = malloc(sizeof(struct RHPParamBlock)); + ParamBlock->sockptr = sockptr; ParamBlock->Socket = sockptr->socket; ParamBlock->Len = Len; ParamBlock->Msg = malloc(Len + 10); memcpy(ParamBlock->Msg, Payload, Len); + sockptr->LastSendTime = time(NULL); + _beginthread(RHPThread, 0, (VOID *)ParamBlock); sockptr->InputLen = 0; diff --git a/Versions.h b/Versions.h index fd58139..6098cd4 100644 --- a/Versions.h +++ b/Versions.h @@ -10,8 +10,8 @@ #endif -#define KVers 6,0,24,64 -#define KVerstring "6.0.24.64\0" +#define KVers 6,0,24,65 +#define KVerstring "6.0.24.65\0" #ifdef CKernel