aboutsummaryrefslogtreecommitdiff
path: root/tests/profiling/gatordmock/GatordMockService.cpp
diff options
context:
space:
mode:
authorFinn Williams <Finn.Williams@arm.com>2020-02-27 16:21:41 +0000
committerJim Flynn <jim.flynn@arm.com>2020-03-18 12:59:19 +0000
commite6a2ccd09060ba93203ddc5a7f79260cedf2c147 (patch)
treec542464311f16acde42fbe01df9f4d8a78feff64 /tests/profiling/gatordmock/GatordMockService.cpp
parenteba482e691bb314e1379d29f267ec3b46a082d01 (diff)
downloadarmnn-e6a2ccd09060ba93203ddc5a7f79260cedf2c147.tar.gz
IVGCVSW-4161 Provide for per model call back registration
!armnn:2810 Signed-off-by: Finn Williams <Finn.Williams@arm.com> Change-Id: Idf56d42bd767baa5df0059a2f489f75281f8ac71
Diffstat (limited to 'tests/profiling/gatordmock/GatordMockService.cpp')
-rw-r--r--tests/profiling/gatordmock/GatordMockService.cpp25
1 files changed, 7 insertions, 18 deletions
diff --git a/tests/profiling/gatordmock/GatordMockService.cpp b/tests/profiling/gatordmock/GatordMockService.cpp
index c5211962d3..a3f732cb55 100644
--- a/tests/profiling/gatordmock/GatordMockService.cpp
+++ b/tests/profiling/gatordmock/GatordMockService.cpp
@@ -24,11 +24,11 @@ namespace armnn
namespace gatordmock
{
-bool GatordMockService::OpenListeningSocket(std::string udsNamespace)
+bool GatordMockService::OpenListeningSocket(armnnUtils::Sockets::Socket listeningSocket,
+ const std::string udsNamespace,
+ const int numOfConnections)
{
- Sockets::Initialize();
- m_ListeningSocket = socket(PF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0);
- if (-1 == m_ListeningSocket)
+ if (-1 == listeningSocket)
{
std::cerr << ": Socket construction failed: " << strerror(errno) << std::endl;
return false;
@@ -41,13 +41,13 @@ bool GatordMockService::OpenListeningSocket(std::string udsNamespace)
udsAddress.sun_family = AF_UNIX;
// Bind the socket to the UDS namespace.
- if (-1 == bind(m_ListeningSocket, reinterpret_cast<const sockaddr*>(&udsAddress), sizeof(sockaddr_un)))
+ if (-1 == bind(listeningSocket, reinterpret_cast<const sockaddr*>(&udsAddress), sizeof(sockaddr_un)))
{
std::cerr << ": Binding on socket failed: " << strerror(errno) << std::endl;
return false;
}
- // Listen for 1 connection.
- if (-1 == listen(m_ListeningSocket, 1))
+ // Listen for 10 connections.
+ if (-1 == listen(listeningSocket, numOfConnections))
{
std::cerr << ": Listen call on socket failed: " << strerror(errno) << std::endl;
return false;
@@ -55,17 +55,6 @@ bool GatordMockService::OpenListeningSocket(std::string udsNamespace)
return true;
}
-Sockets::Socket GatordMockService::BlockForOneClient()
-{
- m_ClientConnection = Sockets::Accept(m_ListeningSocket, nullptr, nullptr, SOCK_CLOEXEC);
- if (-1 == m_ClientConnection)
- {
- std::cerr << ": Failure when waiting for a client connection: " << strerror(errno) << std::endl;
- return -1;
- }
- return m_ClientConnection;
-}
-
bool GatordMockService::WaitForStreamMetaData()
{
if (m_EchoPackets)