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:
Nick Bolton
2012-07-05 18:05:35 +00:00
parent 4e268760b3
commit 3d6551f708
57 changed files with 367 additions and 173 deletions

View File

@@ -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);

View File

@@ -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,
};

View File

@@ -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)))