Bug fixes for Windows

fixed a bug in windows that caused the application to
fail detect that there is a host instance running
when there is indeed a host instance running.

also fixed a compile bug that cause QtCore to double
import and in turn call out duplicate definition
errors in windows when including applink.c.
This commit is contained in:
Maurice ONeal 2020-08-09 16:29:47 -04:00
parent 8a06b5a186
commit 50cd138045
6 changed files with 15 additions and 19 deletions

View File

@ -7,9 +7,7 @@
* https://www.openssl.org/source/license.html
*/
#include <QtCore>
#ifdef Q_OS_WINDOWS
#ifdef NEED_APPLINK
#define APPLINK_STDIN 1
#define APPLINK_STDOUT 2

View File

@ -996,23 +996,21 @@ ShellIPC::ShellIPC(const QStringList &args, bool supressErr, QObject *parent) :
bool ShellIPC::connectToHost()
{
auto pipeInfo = QFileInfo(QDir::tempPath() + "/" + HOST_CONTROL_PIPE);
auto pipeInfo = QFileInfo(HOST_CONTROL_PIPE);
if (!pipeInfo.exists())
connectToServer(HOST_CONTROL_PIPE);
if (!waitForConnected() && !holdErrs)
{
if (!holdErrs)
QTextStream(stdout) << "" << Qt::endl << "err: Failed to connect to the host instance control pipe." << Qt::endl;
if (error() == QLocalSocket::ServerNotFoundError)
{
QTextStream(stdout) << "" << Qt::endl << "A host instance is not running." << Qt::endl << Qt::endl;
QTextStream(stdout) << "err: Reason - Host instance not running." << Qt::endl << Qt::endl;
}
}
else
{
connectToServer(HOST_CONTROL_PIPE);
if (!waitForConnected() && !holdErrs)
else
{
QTextStream(stdout) << "" << Qt::endl << "err: Failed to connect to the host instance control pipe." << Qt::endl;
QTextStream(stdout) << "err: Reason - " << errorString() << Qt::endl;
QTextStream(stdout) << "err: Reason - " << errorString() << Qt::endl << Qt::endl;
}
}

View File

@ -39,7 +39,7 @@
#include "shell.h"
#define APP_NAME "MRCI"
#define APP_VER "4.0.2.0"
#define APP_VER "4.1.2.0"
#define APP_TARGET "mrci"
#ifdef Q_OS_WIN

View File

@ -26,6 +26,7 @@
// <http://www.gnu.org/licenses/>.
#ifdef Q_OS_WINDOWS
#define NEED_APPLINK
extern "C"
{
// applink.c was copied from the openssl lib and slightly modified so

View File

@ -66,10 +66,10 @@ bool TCPServer::createPipe()
{
auto ret = controlPipe->listen(HOST_CONTROL_PIPE);
controlPipePath = controlPipe->fullServerName();
if (!ret)
{
auto controlPipePath = controlPipe->fullServerName();
if (QFile::exists(controlPipePath))
{
QFile::remove(controlPipePath);

View File

@ -37,7 +37,6 @@ private:
char *hostLoad;
QList<QSslCertificate> sslChain;
QSslKey sslKey;
QString controlPipePath;
QString hostKey;
QString wanIP;
quint32 maxSessions;