diff --git a/AGWCode.cpp b/AGWCode.cpp index 8a99232..9cdc0ec 100644 --- a/AGWCode.cpp +++ b/AGWCode.cpp @@ -588,7 +588,7 @@ void QtTermTCP::onAGWSocketStateChanged(QAbstractSocket::SocketState socketState if (Sess) { AGWUsers->MonSess = Sess; - Sess->AGWSession = sender; // Flag as in use +// Sess->AGWSession = sender; // Flag as in use if (TermMode == MDI) Sess->setWindowTitle("AGW Monitor Window"); @@ -1038,9 +1038,9 @@ void on_AGW_C_frame(AGWUser * AGW, struct AGWHeader * Frame, byte * Msg) Sess = newWindow((QObject *)mythis, Listen, ""); } } - else + else if (TermMode == Tabbed) { - // Single or Tabbed - look for free session + // Single Tabbed - look for free session for (i = 0; i < _sessions.size(); ++i) @@ -1053,15 +1053,33 @@ void on_AGW_C_frame(AGWUser * AGW, struct AGWHeader * Frame, byte * Msg) break; } } + } + else + { + // Single - Only one available + S = _sessions.at(0); - if (Sess == NULL) - { - // Clear connection - - return; - } + if (S->clientSocket == NULL && S->AGWSession == NULL && S->KISSSession == NULL) + Sess = S; } + if (Sess == NULL) + { + // Clear connection by sendinf d fraame + + UCHAR Msg[512]; + + int snd_ch = Frame->Port; + char * CallFrom = Frame->callfrom; + char * CallTo = Frame->callto; + + AGW_frame_header(Msg, Frame->Port, 'd', 240, Frame->callto, Frame->callfrom, 0); + if (AGW->socket) + AGW->socket->write((char *)Msg, AGWHDDRRLEN); + + return; + } + if (Sess) { sprintf(Title, "Connected to %s", CallFrom); diff --git a/QtTermTCP.cpp b/QtTermTCP.cpp index 8c6cc6e..e640397 100644 --- a/QtTermTCP.cpp +++ b/QtTermTCP.cpp @@ -2,7 +2,7 @@ // Application icon design by Red PE1RRR -#define VersionString "0.0.0.77 Beta 1" +#define VersionString "0.0.0.77" // .12 Save font weight @@ -118,6 +118,7 @@ // .77 // Support multichannel KISS TNCs (Beta 1) +// Fix using AGW listen in single terminal mode #define _CRT_SECURE_NO_WARNINGS