aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/ipc
diff options
context:
space:
mode:
authorLibravatarUnit 193 <unit193@unit193.net>2021-11-10 00:54:35 -0500
committerLibravatarUnit 193 <unit193@unit193.net>2021-11-10 00:54:35 -0500
commit58fb7a0cee13d84170aac52f3f89d91888e1afe3 (patch)
tree1d6312ba15f9ece5a8031e5280dfb8b38be8dfa3 /src/lib/ipc
parent28db84b46139c9bb2bbcac8c6cc56e71d1e35629 (diff)
parentbeb08eb751fa8e1f72042f263316ab5e5ddb596d (diff)
Update upstream source from tag 'upstream/2.4.0+dfsg'
Update to upstream version '2.4.0+dfsg' with Debian dir 4b6668cc08c7b0e56b1e1f7b4e89ecdb316182a0
Diffstat (limited to 'src/lib/ipc')
-rw-r--r--src/lib/ipc/CMakeLists.txt4
-rw-r--r--src/lib/ipc/Ipc.h4
-rw-r--r--src/lib/ipc/IpcClient.cpp4
-rw-r--r--src/lib/ipc/IpcClient.h6
-rw-r--r--src/lib/ipc/IpcClientProxy.cpp8
-rw-r--r--src/lib/ipc/IpcClientProxy.h6
-rw-r--r--src/lib/ipc/IpcLogOutputter.cpp11
-rw-r--r--src/lib/ipc/IpcLogOutputter.h16
-rw-r--r--src/lib/ipc/IpcMessage.cpp4
-rw-r--r--src/lib/ipc/IpcMessage.h4
-rw-r--r--src/lib/ipc/IpcServer.cpp4
-rw-r--r--src/lib/ipc/IpcServer.h8
-rw-r--r--src/lib/ipc/IpcServerProxy.cpp12
-rw-r--r--src/lib/ipc/IpcServerProxy.h4
14 files changed, 46 insertions, 49 deletions
diff --git a/src/lib/ipc/CMakeLists.txt b/src/lib/ipc/CMakeLists.txt
index 3c7302a..e7ada8f 100644
--- a/src/lib/ipc/CMakeLists.txt
+++ b/src/lib/ipc/CMakeLists.txt
@@ -1,11 +1,11 @@
# barrier -- mouse and keyboard sharing utility
# Copyright (C) 2012-2016 Symless Ltd.
# Copyright (C) 2009 Nick Bolton
-#
+#
# This package is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# found in the file LICENSE that should have accompanied this file.
-#
+#
# This package is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/ipc/Ipc.h b/src/lib/ipc/Ipc.h
index bc69c08..65e7aaf 100644
--- a/src/lib/ipc/Ipc.h
+++ b/src/lib/ipc/Ipc.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2012 Nick Bolton
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/ipc/IpcClient.cpp b/src/lib/ipc/IpcClient.cpp
index 4eeae5b..ea5eee1 100644
--- a/src/lib/ipc/IpcClient.cpp
+++ b/src/lib/ipc/IpcClient.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2012 Nick Bolton
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/ipc/IpcClient.h b/src/lib/ipc/IpcClient.h
index 1e9bca6..900b46c 100644
--- a/src/lib/ipc/IpcClient.h
+++ b/src/lib/ipc/IpcClient.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2012 Nick Bolton
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -42,7 +42,7 @@ public:
//! Connects to the IPC server at localhost.
void connect();
-
+
//! Disconnects from the IPC server.
void disconnect();
diff --git a/src/lib/ipc/IpcClientProxy.cpp b/src/lib/ipc/IpcClientProxy.cpp
index 432cc8c..cedfa5b 100644
--- a/src/lib/ipc/IpcClientProxy.cpp
+++ b/src/lib/ipc/IpcClientProxy.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2012 Nick Bolton
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -67,7 +67,7 @@ IpcClientProxy::~IpcClientProxy()
m_events->forIStream().inputShutdown(), m_stream.getEventTarget());
m_events->removeHandler(
m_events->forIStream().outputShutdown(), m_stream.getEventTarget());
-
+
// don't delete the stream while it's being used.
{
std::lock_guard<std::mutex> lock_read(m_readMutex);
@@ -145,7 +145,7 @@ IpcClientProxy::send(const IpcMessage& message)
ProtocolUtil::writef(&m_stream, kIpcMsgLogLine, &logLine);
break;
}
-
+
case kIpcShutdown:
ProtocolUtil::writef(&m_stream, kIpcMsgShutdown);
break;
diff --git a/src/lib/ipc/IpcClientProxy.h b/src/lib/ipc/IpcClientProxy.h
index eb9f1e9..dbd0846 100644
--- a/src/lib/ipc/IpcClientProxy.h
+++ b/src/lib/ipc/IpcClientProxy.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2012 Nick Bolton
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -46,7 +46,7 @@ private:
IpcHelloMessage* parseHello();
IpcCommandMessage* parseCommand();
void disconnect();
-
+
private:
barrier::IStream& m_stream;
EIpcClientType m_clientType;
diff --git a/src/lib/ipc/IpcLogOutputter.cpp b/src/lib/ipc/IpcLogOutputter.cpp
index 44ecdba..5118a0a 100644
--- a/src/lib/ipc/IpcLogOutputter.cpp
+++ b/src/lib/ipc/IpcLogOutputter.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2012 Nick Bolton
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -28,7 +28,6 @@
#include "base/Event.h"
#include "base/EventQueue.h"
#include "base/TMethodEventJob.h"
-#include "base/TMethodJob.h"
enum EIpcLogOutputter {
kBufferMaxSize = 1000,
@@ -54,8 +53,7 @@ IpcLogOutputter::IpcLogOutputter(IpcServer& ipcServer, EIpcClientType clientType
m_clientType(clientType)
{
if (useThread) {
- m_bufferThread = new Thread(new TMethodJob<IpcLogOutputter>(
- this, &IpcLogOutputter::bufferThread));
+ m_bufferThread = new Thread([this](){ buffer_thread(); });
}
}
@@ -142,8 +140,7 @@ IpcLogOutputter::isRunning()
return m_running;
}
-void
-IpcLogOutputter::bufferThread(void*)
+void IpcLogOutputter::buffer_thread()
{
m_bufferThreadId = m_bufferThread->getID();
m_running = true;
diff --git a/src/lib/ipc/IpcLogOutputter.h b/src/lib/ipc/IpcLogOutputter.h
index cc7b2fe..3f3ab0a 100644
--- a/src/lib/ipc/IpcLogOutputter.h
+++ b/src/lib/ipc/IpcLogOutputter.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2012 Nick Bolton
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -50,7 +50,7 @@ public:
virtual void close();
virtual void show(bool showIfEmpty);
virtual bool write(ELevel level, const char* message);
-
+
//! @name manipulators
//@{
@@ -76,23 +76,23 @@ public:
when threaded mode is on.
*/
void sendBuffer();
-
+
//@}
-
+
//! @name accessors
//@{
-
+
//! Get the buffer size
/*!
Returns the maximum size of the buffer.
*/
UInt16 bufferMaxSize() const;
-
+
//@}
private:
void init();
- void bufferThread(void*);
+ void buffer_thread();
std::string getChunk(size_t count);
void appendBuffer(const std::string& text);
bool isRunning();
diff --git a/src/lib/ipc/IpcMessage.cpp b/src/lib/ipc/IpcMessage.cpp
index 9c321cb..f1b13b1 100644
--- a/src/lib/ipc/IpcMessage.cpp
+++ b/src/lib/ipc/IpcMessage.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2012 Nick Bolton
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/ipc/IpcMessage.h b/src/lib/ipc/IpcMessage.h
index d37ebc3..06ca08a 100644
--- a/src/lib/ipc/IpcMessage.h
+++ b/src/lib/ipc/IpcMessage.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2012 Nick Bolton
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/ipc/IpcServer.cpp b/src/lib/ipc/IpcServer.cpp
index 8df98d1..da201c1 100644
--- a/src/lib/ipc/IpcServer.cpp
+++ b/src/lib/ipc/IpcServer.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2012 Nick Bolton
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
diff --git a/src/lib/ipc/IpcServer.h b/src/lib/ipc/IpcServer.h
index 179bad8..f6227f2 100644
--- a/src/lib/ipc/IpcServer.h
+++ b/src/lib/ipc/IpcServer.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2012 Nick Bolton
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -73,7 +73,7 @@ private:
private:
typedef std::list<IpcClientProxy*> ClientList;
-
+
bool m_mock;
IEventQueue* m_events;
SocketMultiplexer* m_socketMultiplexer;
@@ -82,7 +82,7 @@ private:
ClientList m_clients;
mutable std::mutex m_clientsMutex;
-#ifdef TEST_ENV
+#ifdef BARRIER_TEST_ENV
public:
IpcServer() :
m_mock(true),
diff --git a/src/lib/ipc/IpcServerProxy.cpp b/src/lib/ipc/IpcServerProxy.cpp
index 49b3e00..073f7e7 100644
--- a/src/lib/ipc/IpcServerProxy.cpp
+++ b/src/lib/ipc/IpcServerProxy.cpp
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2012 Nick Bolton
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -56,7 +56,7 @@ IpcServerProxy::handleData(const Event&, void*)
LOG((CLOG_DEBUG "ipc read: %c%c%c%c",
code[0], code[1], code[2], code[3]));
-
+
IpcMessage* m = nullptr;
if (memcmp(code, kIpcMsgLogLine, 4) == 0) {
m = parseLogLine();
@@ -68,7 +68,7 @@ IpcServerProxy::handleData(const Event&, void*)
LOG((CLOG_ERR "invalid ipc message"));
disconnect();
}
-
+
// don't delete with this event; the data is passed to a new event.
Event e(m_events->forIpcServerProxy().messageReceived(), this, NULL, Event::kDontFreeData);
e.setDataObject(m);
@@ -76,7 +76,7 @@ IpcServerProxy::handleData(const Event&, void*)
n = m_stream.read(code, 4);
}
-
+
LOG((CLOG_DEBUG "finished ipc handle data"));
}
@@ -110,7 +110,7 @@ IpcServerProxy::parseLogLine()
{
std::string logLine;
ProtocolUtil::readf(&m_stream, kIpcMsgLogLine + 4, &logLine);
-
+
// must be deleted by event handler.
return new IpcLogLineMessage(logLine);
}
diff --git a/src/lib/ipc/IpcServerProxy.h b/src/lib/ipc/IpcServerProxy.h
index f2218a4..f724f97 100644
--- a/src/lib/ipc/IpcServerProxy.h
+++ b/src/lib/ipc/IpcServerProxy.h
@@ -2,11 +2,11 @@
* barrier -- mouse and keyboard sharing utility
* Copyright (C) 2012-2016 Symless Ltd.
* Copyright (C) 2012 Nick Bolton
- *
+ *
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
- *
+ *
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the