mirror of
https://github.com/debauchee/barrier.git
synced 2025-06-21 12:07:04 +02: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:
parent
4e268760b3
commit
3d6551f708
57 changed files with 367 additions and 173 deletions
|
@ -34,14 +34,19 @@ m_address(CNetworkAddress(IPC_HOST, IPC_PORT))
|
|||
m_address.resolve();
|
||||
|
||||
EVENTQUEUE->adoptHandler(
|
||||
IListenSocket::getConnectingEvent(), &m_socket,
|
||||
m_socket.getConnectingEvent(), &m_socket,
|
||||
new TMethodEventJob<CIpcServer>(
|
||||
this, &CIpcServer::handleClientConnecting));
|
||||
}
|
||||
|
||||
CIpcServer::~CIpcServer()
|
||||
{
|
||||
EVENTQUEUE->removeHandler(IListenSocket::getConnectingEvent(), &m_socket);
|
||||
CClientSet::iterator it;
|
||||
for (it = m_clients.begin(); it != m_clients.end(); it++) {
|
||||
delete *it;
|
||||
}
|
||||
|
||||
EVENTQUEUE->removeHandler(m_socket.getConnectingEvent(), &m_socket);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -53,12 +58,11 @@ CIpcServer::listen()
|
|||
void
|
||||
CIpcServer::handleClientConnecting(const CEvent&, void*)
|
||||
{
|
||||
IStream* stream = m_socket.accept();
|
||||
synergy::IStream* stream = m_socket.accept();
|
||||
if (stream == NULL) {
|
||||
return;
|
||||
}
|
||||
// when there is already a client connected, this causes stack overflow,
|
||||
//
|
||||
|
||||
LOG((CLOG_NOTE "accepted ipc client connection"));
|
||||
|
||||
// TODO: delete on disconnect
|
||||
|
@ -76,10 +80,13 @@ CIpcServer::getClientConnectedEvent()
|
|||
}
|
||||
|
||||
void
|
||||
CIpcServer::send(const CIpcMessage& message)
|
||||
CIpcServer::send(const CIpcMessage& message, EIpcClientType filterType)
|
||||
{
|
||||
CClientSet::iterator it;
|
||||
for (it = m_clients.begin(); it != m_clients.end(); it++) {
|
||||
(*it)->send(message);
|
||||
CIpcClientProxy* proxy = *it;
|
||||
if (proxy->m_clientType == filterType) {
|
||||
proxy->send(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue