From 424c0bd3e14d3ddda6c2d945b6465d51c462c76b Mon Sep 17 00:00:00 2001 From: Dave Hibberd Date: Tue, 5 Nov 2024 21:03:15 +0000 Subject: New upstream version 6.0.24.49 --- CommonCode.c | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) (limited to 'CommonCode.c') diff --git a/CommonCode.c b/CommonCode.c index 1b6352f..a392b17 100644 --- a/CommonCode.c +++ b/CommonCode.c @@ -28,6 +28,7 @@ along with LinBPQ/BPQ32. If not, see http://www.gnu.org/licenses #include #include #include +#include "mqtt.h" #pragma data_seg("_BPQDATA") @@ -735,22 +736,7 @@ VOID CheckForDetach(struct TNCINFO * TNC, int Stream, struct STREAMINFO * STREAM // Create a traffic record - if (STREAM->Connected && STREAM->ConnectTime) - { - Duration = time(NULL) - STREAM->ConnectTime; - - if (Duration == 0) - Duration = 1; // Or will get divide by zero error - - sprintf(logmsg,"Port %2d %9s Bytes Sent %d BPS %d Bytes Received %d BPS %d Time %d Seconds", - TNC->Port, STREAM->RemoteCall, - STREAM->BytesTXed, (int)(STREAM->BytesTXed/Duration), - STREAM->BytesRXed, (int)(STREAM->BytesRXed/Duration), (int)Duration); - - Debugprintf(logmsg); - - STREAM->ConnectTime = 0; - } + hookL4SessionDeleted(TNC, STREAM); if (STREAM->BPQtoPACTOR_Q) // Still data to send? return; // Will close when all acked @@ -920,6 +906,7 @@ BOOL ProcessIncommingConnectEx(struct TNCINFO * TNC, char * Call, int Stream, BO int Totallen = 0; UCHAR * ptr; struct PORTCONTROL * PORT = (struct PORTCONTROL *)TNC->PortRecord; + struct STREAMINFO * STREAM = &TNC->Streams[Stream]; // Stop Scanner @@ -952,7 +939,11 @@ BOOL ProcessIncommingConnectEx(struct TNCINFO * TNC, char * Call, int Stream, BO memset(Session, 0, sizeof(TRANSPORTENTRY)); - memcpy(TNC->Streams[Stream].RemoteCall, Call, 9); // Save Text Callsign + memcpy(STREAM->RemoteCall, Call, 9); // Save Text Callsign + + // May be subsequently rejected but a good place to capture calls + + hookL4SessionAccepted(STREAM, Call, TNC->TargetCall); if (AllowTR) ConvToAX25Ex(Call, Session->L4USER); // Allow -T and -R SSID's for MPS @@ -965,7 +956,7 @@ BOOL ProcessIncommingConnectEx(struct TNCINFO * TNC, char * Call, int Stream, BO if (NEXTID == 0) NEXTID++; // Keep non-zero TNC->PortRecord->ATTACHEDSESSIONS[Stream] = Session; - TNC->Streams[Stream].Attached = TRUE; + STREAM->Attached = TRUE; Session->L4TARGET.EXTPORT = TNC->PortRecord; @@ -976,7 +967,7 @@ BOOL ProcessIncommingConnectEx(struct TNCINFO * TNC, char * Call, int Stream, BO Session->SESSPACLEN = TNC->PortRecord->PORTCONTROL.PORTPACLEN; Session->KAMSESSION = Stream; - TNC->Streams[Stream].Connected = TRUE; // Subsequent data to data channel + STREAM->Connected = TRUE; // Subsequent data to data channel if (LogAllConnects) { @@ -3716,6 +3707,11 @@ VOID OpenReportingSockets() Chatreportdest.sin_port = htons(81); _beginthread(ResolveUpdateThread, 0, NULL); + + printf("MQTT Enabled %d\n", MQTT); + + if (MQTT) + MQTTConnect(MQTT_HOST, MQTT_PORT, MQTT_USER, MQTT_PASS); } VOID WriteMiniDumpThread(); -- cgit v1.2.3