mirror of
https://github.com/debauchee/barrier.git
synced 2026-11-27 22:32:02 +08:00
moved stream into synergy namespace (to prevent naming collision in win libs)
implemented ipc "hello" message (to identify client type) integ tests working for hello message, but use of ipc in main program has problem with events.
This commit is contained in:
@@ -25,6 +25,7 @@ IpcClient::IpcClient()
|
||||
{
|
||||
m_Socket = new QTcpSocket(this);
|
||||
connect(m_Socket, SIGNAL(readyRead()), this, SLOT(read()));
|
||||
connect(m_Socket, SIGNAL(connected()), this, SLOT(connected()));
|
||||
connect(m_Socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(error(QAbstractSocket::SocketError)));
|
||||
}
|
||||
|
||||
@@ -32,6 +33,15 @@ IpcClient::~IpcClient()
|
||||
{
|
||||
}
|
||||
|
||||
void IpcClient::connected()
|
||||
{
|
||||
infoMessage("connected to background service");
|
||||
|
||||
char typeBuf[1];
|
||||
typeBuf[0] = kIpcClientGui;
|
||||
write(kIpcHello, 1, typeBuf);
|
||||
}
|
||||
|
||||
void IpcClient::connectToHost()
|
||||
{
|
||||
infoMessage("connecting to background service...");
|
||||
@@ -52,6 +62,7 @@ void IpcClient::read()
|
||||
char lenBuf[2];
|
||||
stream.readRawData(lenBuf, 2);
|
||||
int len = bytesToInt(lenBuf, 2);
|
||||
std::cout << "len: " << len << std::endl;
|
||||
|
||||
char* data = new char[len];
|
||||
stream.readRawData(data, len);
|
||||
|
||||
@@ -42,6 +42,7 @@ private:
|
||||
void intToBytes(int value, char* buffer, int size);
|
||||
|
||||
private slots:
|
||||
void connected();
|
||||
void read();
|
||||
void error(QAbstractSocket::SocketError error);
|
||||
|
||||
@@ -54,7 +55,15 @@ private:
|
||||
QTcpSocket* m_Socket;
|
||||
};
|
||||
|
||||
enum EIpcMessage {
|
||||
enum IpcMessageType {
|
||||
kIpcHello,
|
||||
kIpcLogLine,
|
||||
kIpcCommand
|
||||
kIpcCommand,
|
||||
kIpcShutdown,
|
||||
};
|
||||
|
||||
enum IpcClientType {
|
||||
kIpcClientUnknown,
|
||||
kIpcClientGui,
|
||||
kIpcClientNode,
|
||||
};
|
||||
|
||||
@@ -369,6 +369,11 @@ void MainWindow::startSynergy()
|
||||
{
|
||||
setSynergyProcess(new QProcess(this));
|
||||
}
|
||||
else
|
||||
{
|
||||
// tell client/server to talk to daemon through ipc.
|
||||
args << "--ipc";
|
||||
}
|
||||
|
||||
if ((synergyType() == synergyClient && !clientArgs(args, app))
|
||||
|| (synergyType() == synergyServer && !serverArgs(args, app)))
|
||||
|
||||
Reference in New Issue
Block a user