From 66e3f0dd06a7035dc0931536b343e6fa80ef7fcc Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Fri, 1 Sep 2023 20:15:17 +0200 Subject: [PATCH 1/3] iox-#1036 Port 'NamedPipe' to builder pattern --- .../iceoryx_dust/posix_wrapper/named_pipe.hpp | 70 ++++-- .../source/posix_wrapper/named_pipe.cpp | 223 +++++++----------- 2 files changed, 137 insertions(+), 156 deletions(-) diff --git a/iceoryx_dust/include/iceoryx_dust/posix_wrapper/named_pipe.hpp b/iceoryx_dust/include/iceoryx_dust/posix_wrapper/named_pipe.hpp index b01a5eddd7..1693162ecb 100644 --- a/iceoryx_dust/include/iceoryx_dust/posix_wrapper/named_pipe.hpp +++ b/iceoryx_dust/include/iceoryx_dust/posix_wrapper/named_pipe.hpp @@ -1,4 +1,5 @@ // Copyright (c) 2021 - 2022 by Apex.AI Inc. All rights reserved. +// Copyright (c) 2023 by Mathias Kraus . All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -16,7 +17,6 @@ #ifndef IOX_DUST_POSIX_WRAPPER_NAMED_PIPE_HPP #define IOX_DUST_POSIX_WRAPPER_NAMED_PIPE_HPP -#include "iceoryx_dust/design/creation.hpp" #include "iceoryx_dust/iceoryx_dust_deployment.hpp" #include "iceoryx_hoofs/concurrent/lockfree_queue.hpp" #include "iceoryx_hoofs/internal/posix_wrapper/ipc_channel.hpp" @@ -35,7 +35,7 @@ namespace iox { namespace posix { -class NamedPipe : public DesignPattern::Creation +class NamedPipe { public: // no system restrictions at all, except available memory. MAX_MESSAGE_SIZE and MAX_NUMBER_OF_MESSAGES can be @@ -55,17 +55,26 @@ class NamedPipe : public DesignPattern::Creation using Message_t = string; using MessageQueue_t = concurrent::LockFreeQueue; + NamedPipe() noexcept = delete; NamedPipe(const NamedPipe&) = delete; NamedPipe& operator=(const NamedPipe&) = delete; - /// @brief For compatibility with IpcChannel alias, default ctor which creates - /// an uninitialized NamedPipe. - NamedPipe() noexcept; - NamedPipe(NamedPipe&& rhs) noexcept; NamedPipe& operator=(NamedPipe&& rhs) noexcept; ~NamedPipe() noexcept; + /// @todo iox-#1036 Remove when all channels are ported to the builder pattern + static expected create(const IpcChannelName_t& name, + const IpcChannelSide channelSide, + const size_t maxMsgSize = MAX_MESSAGE_SIZE, + const uint64_t maxMsgNumber = MAX_NUMBER_OF_MESSAGES) noexcept; + + /// @todo iox-#1036 Remove when all channels are ported to the builder pattern + bool isInitialized() const noexcept + { + return m_data != nullptr; + } + /// @brief removes a named pipe artifact from the system /// @return true if the artifact was removed, false when no artifact was found and /// IpcChannelError::INTERNAL_LOGIC_ERROR when shm_unlink failed @@ -103,33 +112,22 @@ class NamedPipe : public DesignPattern::Creation expected timedReceive(const units::Duration& timeout) const noexcept; private: - friend class DesignPattern::Creation; - - /// @brief constructor which creates a named pipe. This creates a shared memory file with the - /// prefix NAMED_PIPE_PREFIX concatenated with name. - /// @param[in] name the name of the named pipe - /// @param[in] channelSide defines the channel side (server creates the shared memory, clients opens it) - /// @param[in] maxMsgSize maximum message size, must be less or equal than MAX_MESSAGE_SIZE - /// @param[in] maxMsgNumber the maximum number of messages, must be less or equal than MAX_NUMBER_OF_MESSAGES - NamedPipe(const IpcChannelName_t& name, - const IpcChannelSide channelSide, - const size_t maxMsgSize = MAX_MESSAGE_SIZE, - const uint64_t maxMsgNumber = MAX_NUMBER_OF_MESSAGES) noexcept; + friend class NamedPipeBuilder; + + class NamedPipeData; + NamedPipe(SharedMemoryObject&& sharedMemory, NamedPipeData* data) noexcept; template - static IpcChannelName_t convertName(const Prefix& p, const IpcChannelName_t& name) noexcept; + static IpcChannelName_t mapToSharedMemoryName(const Prefix& p, const IpcChannelName_t& name) noexcept; /// @brief destroys an initialized named pipe. /// @return is always successful expected destroy() noexcept; - private: - optional m_sharedMemory; - class NamedPipeData { public: - NamedPipeData(bool& isInitialized, IpcChannelError& error, const uint32_t maxMsgNumber) noexcept; + NamedPipeData() noexcept = default; NamedPipeData(const NamedPipeData&) = delete; NamedPipeData(NamedPipeData&& rhs) = delete; @@ -140,6 +138,8 @@ class NamedPipe : public DesignPattern::Creation UnnamedSemaphore& sendSemaphore() noexcept; UnnamedSemaphore& receiveSemaphore() noexcept; + expected initialize(const uint32_t maxMsgNumber) noexcept; + bool waitForInitialization() const noexcept; bool hasValidState() const noexcept; @@ -156,9 +156,31 @@ class NamedPipe : public DesignPattern::Creation optional m_receiveSemaphore; }; - + private: + SharedMemoryObject m_sharedMemory; NamedPipeData* m_data = nullptr; }; + +class NamedPipeBuilder +{ + /// @brief Defines the named pipe name + IOX_BUILDER_PARAMETER(IpcChannelName_t, name, "") + + /// @brief Defines how the named pipe is opened, i.e. as client or server + IOX_BUILDER_PARAMETER(IpcChannelSide, channelSide, IpcChannelSide::CLIENT) + + /// @brief Defines the max message size of the named pipe + IOX_BUILDER_PARAMETER(size_t, maxMsgSize, NamedPipe::MAX_MESSAGE_SIZE) + + /// @brief Defines the max number of messages for the named pipe. + IOX_BUILDER_PARAMETER(uint64_t, maxMsgNumber, NamedPipe::MAX_NUMBER_OF_MESSAGES) + + public: + /// @brief create a named pipe + /// @return On success a 'NamedPipe' is returned and on failure an 'IpcChannelError'. + expected create() const noexcept; +}; + } // namespace posix } // namespace iox diff --git a/iceoryx_dust/source/posix_wrapper/named_pipe.cpp b/iceoryx_dust/source/posix_wrapper/named_pipe.cpp index 75d8b56116..a95028fb7d 100644 --- a/iceoryx_dust/source/posix_wrapper/named_pipe.cpp +++ b/iceoryx_dust/source/posix_wrapper/named_pipe.cpp @@ -1,4 +1,5 @@ // Copyright (c) 2021 - 2023 by Apex.AI Inc. All rights reserved. +// Copyright (c) 2023 by Mathias Kraus . All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. @@ -34,113 +35,116 @@ constexpr units::Duration NamedPipe::CYCLE_TIME; constexpr units::Duration NamedPipe::NamedPipeData::WAIT_FOR_INIT_SLEEP_TIME; constexpr units::Duration NamedPipe::NamedPipeData::WAIT_FOR_INIT_TIMEOUT; -NamedPipe::NamedPipe() noexcept +expected NamedPipeBuilder::create() const noexcept { - this->m_isInitialized = false; - this->m_errorValue = IpcChannelError::NOT_INITIALIZED; -} - -// NOLINTNEXTLINE(readability-function-size) @todo iox-#832 make a struct out of arguments -NamedPipe::NamedPipe(const IpcChannelName_t& name, - const IpcChannelSide channelSide, - const size_t maxMsgSize, - const uint64_t maxMsgNumber) noexcept -{ - // We do not store maxMsgSize or maxMsgNumber, this is just technical debt since every ipc channel - // requires the same behavior as the message queue. The named pipe would get later two template - // parameters MAX_MSG_SIZE and MAX_MSG_NUMBER from which the Message_t size and m_messages queue - // size is obtained. Reducing the max message size / number of messages even further would not gain - // reduced memory usage or decreased runtime. See issue #832. - if (name.size() + strlen(&NAMED_PIPE_PREFIX[0]) > MAX_MESSAGE_SIZE) + if (m_name.size() + strlen(&NamedPipe::NAMED_PIPE_PREFIX[0]) > NamedPipe::MAX_MESSAGE_SIZE) { - std::cerr << "The named pipe name: \"" << name - << "\" is too long. Maxium name length is: " << MAX_MESSAGE_SIZE - strlen(&NAMED_PIPE_PREFIX[0]) - << std::endl; - m_isInitialized = false; - m_errorValue = IpcChannelError::INVALID_CHANNEL_NAME; - return; + std::cerr << "The named pipe name: \"" << m_name << "\" is too long. Maxium name length is: " + << NamedPipe::MAX_MESSAGE_SIZE - strlen(&NamedPipe::NAMED_PIPE_PREFIX[0]) << std::endl; + return err(IpcChannelError::INVALID_CHANNEL_NAME); } // leading slash is allowed even though it is not a valid file name - bool isValidPipeName = isValidFileName(name) + bool isValidPipeName = isValidFileName(m_name) // name is checked for emptiness, so it's ok to get a first member // NOLINTNEXTLINE(cppcoreguidelines-pro-bounds-pointer-arithmetic) - || (!name.empty() && name.c_str()[0] == '/' && isValidFileName(*name.substr(1))); + || (!m_name.empty() && m_name.c_str()[0] == '/' && isValidFileName(*m_name.substr(1))); if (!isValidPipeName) { - std::cerr << "The named pipe name: \"" << name << "\" is not a valid file path name." << std::endl; - m_isInitialized = false; - m_errorValue = IpcChannelError::INVALID_CHANNEL_NAME; - return; + std::cerr << "The named pipe name: \"" << m_name << "\" is not a valid file path name." << std::endl; + return err(IpcChannelError::INVALID_CHANNEL_NAME); } - if (maxMsgSize > MAX_MESSAGE_SIZE) + if (m_maxMsgSize > NamedPipe::MAX_MESSAGE_SIZE) { - std::cerr << "A message size of " << maxMsgSize << " exceeds the maximum message size for named pipes of " - << MAX_MESSAGE_SIZE << std::endl; - m_isInitialized = false; - m_errorValue = IpcChannelError::MAX_MESSAGE_SIZE_EXCEEDED; - return; + std::cerr << "A message size of " << m_maxMsgSize << " exceeds the maximum message size for named pipes of " + << NamedPipe::MAX_MESSAGE_SIZE << std::endl; + return err(IpcChannelError::MAX_MESSAGE_SIZE_EXCEEDED); } - if (maxMsgNumber > MAX_NUMBER_OF_MESSAGES) + if (m_maxMsgNumber > NamedPipe::MAX_NUMBER_OF_MESSAGES) { - std::cerr << "A message amount of " << maxMsgNumber - << " exceeds the maximum number of messages for named pipes of " << MAX_NUMBER_OF_MESSAGES + std::cerr << "A message amount of " << m_maxMsgNumber + << " exceeds the maximum number of messages for named pipes of " << NamedPipe::MAX_NUMBER_OF_MESSAGES << std::endl; - m_isInitialized = false; - m_errorValue = IpcChannelError::MAX_MESSAGE_SIZE_EXCEEDED; - return; + return err(IpcChannelError::MAX_MESSAGE_SIZE_EXCEEDED); } - if (!SharedMemoryObjectBuilder() - .name(convertName(NAMED_PIPE_PREFIX, name)) - .memorySizeInBytes(sizeof(NamedPipeData) + alignof(NamedPipeData)) - .accessMode(AccessMode::READ_WRITE) - .openMode((channelSide == IpcChannelSide::SERVER) ? OpenMode::OPEN_OR_CREATE : OpenMode::OPEN_EXISTING) - .permissions(perms::owner_all | perms::group_all) - .create() - .and_then([this](auto& value) { m_sharedMemory.emplace(std::move(value)); })) + auto namedPipeShmName = NamedPipe::mapToSharedMemoryName(NamedPipe::NAMED_PIPE_PREFIX, m_name); + auto sharedMemoryResult = + SharedMemoryObjectBuilder() + .name(namedPipeShmName) + .memorySizeInBytes(sizeof(NamedPipe::NamedPipeData) + alignof(NamedPipe::NamedPipeData)) + .accessMode(AccessMode::READ_WRITE) + .openMode((m_channelSide == IpcChannelSide::SERVER) ? OpenMode::OPEN_OR_CREATE : OpenMode::OPEN_EXISTING) + .permissions(perms::owner_all | perms::group_all) + .create(); + + if (sharedMemoryResult.has_error()) { - std::cerr << "Unable to open shared memory: \"" << convertName(NAMED_PIPE_PREFIX, name) - << "\" for named pipe \"" << name << "\"" << std::endl; - m_isInitialized = false; - m_errorValue = (channelSide == IpcChannelSide::CLIENT) ? IpcChannelError::NO_SUCH_CHANNEL - : IpcChannelError::INTERNAL_LOGIC_ERROR; - return; + std::cerr << "Unable to open shared memory: \"" << namedPipeShmName << "\" for named pipe \"" << m_name << "\"" + << std::endl; + return err((m_channelSide == IpcChannelSide::CLIENT) ? IpcChannelError::NO_SUCH_CHANNEL + : IpcChannelError::INTERNAL_LOGIC_ERROR); } + auto& sharedMemory = sharedMemoryResult.value(); - BumpAllocator allocator(m_sharedMemory->getBaseAddress(), - m_sharedMemory->get_size().expect("failed to acquire shm size")); + BumpAllocator allocator(sharedMemory.getBaseAddress(), + sharedMemory.get_size().expect("failed to acquire shm size")); - auto allocationResult = allocator.allocate(sizeof(NamedPipeData), alignof(NamedPipeData)); + auto allocationResult = allocator.allocate(sizeof(NamedPipe::NamedPipeData), alignof(NamedPipe::NamedPipeData)); if (allocationResult.has_error()) { - std::cerr << "Unable to allocate memory for named pipe \"" << name << "\"" << std::endl; - m_isInitialized = false; - m_errorValue = IpcChannelError::MEMORY_ALLOCATION_FAILED; - return; + std::cerr << "Unable to allocate memory for named pipe \"" << m_name << "\"" << std::endl; + return err(IpcChannelError::MEMORY_ALLOCATION_FAILED); } - m_data = static_cast(allocationResult.value()); + auto* data = static_cast(allocationResult.value()); - m_isInitialized = true; - if (m_sharedMemory->hasOwnership()) + if (sharedMemory.hasOwnership()) { - new (m_data) NamedPipeData(m_isInitialized, m_errorValue, static_cast(maxMsgNumber)); + new (data) NamedPipe::NamedPipeData(); + auto dataInitializeResult = data->initialize(static_cast(m_maxMsgNumber)); + if (dataInitializeResult.has_error()) + { + return err(dataInitializeResult.error()); + } } else { - m_isInitialized = m_data->waitForInitialization(); - if (!m_isInitialized) + if (!data->waitForInitialization()) { - m_errorValue = IpcChannelError::INTERNAL_LOGIC_ERROR; + return err(IpcChannelError::INTERNAL_LOGIC_ERROR); } } + + return ok(NamedPipe{std::move(sharedMemory), data}); +} + +// NOLINTNEXTLINE(readability-function-size) @todo iox-#832 make a struct out of arguments +expected NamedPipe::create(const IpcChannelName_t& name, + const IpcChannelSide channelSide, + const size_t maxMsgSize, + const uint64_t maxMsgNumber) noexcept +{ + return NamedPipeBuilder() + .name(name) + .channelSide(channelSide) + .maxMsgSize(maxMsgSize) + .maxMsgNumber(maxMsgNumber) + .create(); +} + +NamedPipe::NamedPipe(SharedMemoryObject&& sharedMemory, NamedPipeData* data) noexcept + : m_sharedMemory(std::move(sharedMemory)) + , m_data(data) +{ } NamedPipe::NamedPipe(NamedPipe&& rhs) noexcept + : m_sharedMemory(std::move(rhs.m_sharedMemory)) + , m_data(std::move(rhs.m_data)) { - *this = std::move(rhs); + rhs.m_data = nullptr; } NamedPipe& NamedPipe::operator=(NamedPipe&& rhs) noexcept @@ -148,10 +152,7 @@ NamedPipe& NamedPipe::operator=(NamedPipe&& rhs) noexcept if (this != &rhs) { IOX_DISCARD_RESULT(destroy()); - CreationPattern_t::operator=(std::move(rhs)); - /// NOLINTJUSTIFICATION iox-#1036 will be fixed with the builder pattern - /// NOLINTNEXTLINE(bugprone-use-after-move,hicpp-invalid-access-moved) m_sharedMemory = std::move(rhs.m_sharedMemory); m_data = rhs.m_data; rhs.m_data = nullptr; @@ -166,7 +167,7 @@ NamedPipe::~NamedPipe() noexcept } template -IpcChannelName_t NamedPipe::convertName(const Prefix& p, const IpcChannelName_t& name) noexcept +IpcChannelName_t NamedPipe::mapToSharedMemoryName(const Prefix& p, const IpcChannelName_t& name) noexcept { IpcChannelName_t channelName = p; @@ -184,15 +185,12 @@ IpcChannelName_t NamedPipe::convertName(const Prefix& p, const IpcChannelName_t& expected NamedPipe::destroy() noexcept { - if (m_isInitialized) + if (m_data) { - m_isInitialized = false; - m_errorValue = IpcChannelError::NOT_INITIALIZED; - if (m_sharedMemory->hasOwnership()) + if (m_sharedMemory.hasOwnership()) { m_data->~NamedPipeData(); } - m_sharedMemory.reset(); m_data = nullptr; } return ok(); @@ -200,7 +198,7 @@ expected NamedPipe::destroy() noexcept expected NamedPipe::unlinkIfExists(const IpcChannelName_t& name) noexcept { - auto result = SharedMemory::unlinkIfExist(convertName(NAMED_PIPE_PREFIX, name)); + auto result = SharedMemory::unlinkIfExist(mapToSharedMemoryName(NAMED_PIPE_PREFIX, name)); if (result.has_error()) { return err(IpcChannelError::INTERNAL_LOGIC_ERROR); @@ -211,11 +209,6 @@ expected NamedPipe::unlinkIfExists(const IpcChannelName_t expected NamedPipe::trySend(const std::string& message) const noexcept { - if (!m_isInitialized) - { - return err(IpcChannelError::NOT_INITIALIZED); - } - if (message.size() > MAX_MESSAGE_SIZE) { return err(IpcChannelError::MESSAGE_TOO_LONG); @@ -235,11 +228,6 @@ expected NamedPipe::trySend(const std::string& message) c expected NamedPipe::send(const std::string& message) const noexcept { - if (!m_isInitialized) - { - return err(IpcChannelError::NOT_INITIALIZED); - } - if (message.size() > MAX_MESSAGE_SIZE) { return err(IpcChannelError::MESSAGE_TOO_LONG); @@ -255,11 +243,6 @@ expected NamedPipe::send(const std::string& message) cons expected NamedPipe::timedSend(const std::string& message, const units::Duration& timeout) const noexcept { - if (!m_isInitialized) - { - return err(IpcChannelError::NOT_INITIALIZED); - } - if (message.size() > MAX_MESSAGE_SIZE) { return err(IpcChannelError::MESSAGE_TOO_LONG); @@ -279,11 +262,6 @@ expected NamedPipe::timedSend(const std::string& message, expected NamedPipe::receive() const noexcept { - if (!m_isInitialized) - { - return err(IpcChannelError::NOT_INITIALIZED); - } - cxx::Expects(!m_data->receiveSemaphore().wait().has_error()); auto message = m_data->messages.pop(); if (message.has_value()) @@ -296,11 +274,6 @@ expected NamedPipe::receive() const noexcept expected NamedPipe::tryReceive() const noexcept { - if (!m_isInitialized) - { - return err(IpcChannelError::NOT_INITIALIZED); - } - auto result = m_data->receiveSemaphore().tryWait(); cxx::Expects(!result.has_error()); @@ -320,11 +293,6 @@ expected NamedPipe::tryReceive() const noexcept expected NamedPipe::timedReceive(const units::Duration& timeout) const noexcept { - if (!m_isInitialized) - { - return err(IpcChannelError::NOT_INITIALIZED); - } - auto result = m_data->receiveSemaphore().timedWait(timeout); cxx::Expects(!result.has_error()); @@ -341,40 +309,31 @@ expected NamedPipe::timedReceive(const units::Dura return err(IpcChannelError::TIMEOUT); } -// NOLINTNEXTLINE(cppcoreguidelines-pro-type-member-init) semaphores are initalized via placementCreate call -NamedPipe::NamedPipeData::NamedPipeData(bool& isInitialized, - IpcChannelError& error, - const uint32_t maxMsgNumber) noexcept +expected NamedPipe::NamedPipeData::initialize(const uint32_t maxMsgNumber) noexcept { auto signalError = [&](const char* name) { std::cerr << "Unable to create " << name << " semaphore for named pipe \"" << 'x' << "\""; - isInitialized = false; - error = IpcChannelError::INTERNAL_LOGIC_ERROR; }; - UnnamedSemaphoreBuilder() - .initialValue(maxMsgNumber) - .isInterProcessCapable(true) - .create(m_sendSemaphore) - .or_else([&](auto) { signalError("send"); }); - - if (!isInitialized) + if (UnnamedSemaphoreBuilder() + .initialValue(maxMsgNumber) + .isInterProcessCapable(true) + .create(m_sendSemaphore) + .has_error()) { - return; + signalError("send"); + return err(IpcChannelError::INTERNAL_LOGIC_ERROR); } - UnnamedSemaphoreBuilder() - .initialValue(0U) - .isInterProcessCapable(true) - .create(m_receiveSemaphore) - .or_else([&](auto) { signalError("receive"); }); - - if (!isInitialized) + if (UnnamedSemaphoreBuilder().initialValue(0U).isInterProcessCapable(true).create(m_receiveSemaphore).has_error()) { - return; + signalError("receive"); + return err(IpcChannelError::INTERNAL_LOGIC_ERROR); } initializationGuard.store(VALID_DATA); + + return ok(); } UnnamedSemaphore& NamedPipe::NamedPipeData::sendSemaphore() noexcept From 3aaac0b645fad9aa5fa57c6864081a94042825bf Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Fri, 1 Sep 2023 20:21:44 +0200 Subject: [PATCH 2/3] iox-#1036 Update release notes --- .../release-notes/iceoryx-unreleased.md | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/doc/website/release-notes/iceoryx-unreleased.md b/doc/website/release-notes/iceoryx-unreleased.md index 1ca33dd89e..b246281ec4 100644 --- a/doc/website/release-notes/iceoryx-unreleased.md +++ b/doc/website/release-notes/iceoryx-unreleased.md @@ -102,6 +102,7 @@ - `MemoryMap` - `SharedMemory` - `MessageQueue` + - `NamedPipe` - `FileLock` - Add the ability to adjust path and file permissions of the file lock - `Mutex` @@ -1151,3 +1152,23 @@ // after auto e = exp.error(); + ``` + +52. `UnixDomainSocket`, `MessageQueue` and `NamedPipe` are not default constructible anymore + + ```cpp + // before + iox::posix::UnixDomainSocket socket; + + // after + // option 1 + iox::optional socket; + // option 2 + iox::posix::UnixDomainSocket socket { UnixDomainSocketBuilder() + .name("foo") + .channelSide(iox::posix::IpcChannelSide::CLIENT) + .create() + .expect("Valid UnixDomainSocket") + }; + + ``` From eed12244b81e08a079eac69acf39de481bcbb83b Mon Sep 17 00:00:00 2001 From: Mathias Kraus Date: Fri, 1 Sep 2023 22:29:12 +0200 Subject: [PATCH 3/3] iox-#1036 Fix mq startup race test on Windows --- .../internal/posix_wrapper/unix_domain_socket.hpp | 3 --- .../test/integrationtests/test_mq_interface_startup_race.cpp | 5 +++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/posix_wrapper/unix_domain_socket.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/internal/posix_wrapper/unix_domain_socket.hpp index e91773c0c2..371b80caa2 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/posix_wrapper/unix_domain_socket.hpp +++ b/iceoryx_hoofs/include/iceoryx_hoofs/internal/posix_wrapper/unix_domain_socket.hpp @@ -47,9 +47,6 @@ class UnixDomainSocket using UdsName_t = string; using Message_t = string; - using result_t = expected; - using errorType_t = IpcChannelError; - UnixDomainSocket() noexcept = delete; UnixDomainSocket(const UnixDomainSocket& other) = delete; UnixDomainSocket(UnixDomainSocket&& other) noexcept; diff --git a/iceoryx_posh/test/integrationtests/test_mq_interface_startup_race.cpp b/iceoryx_posh/test/integrationtests/test_mq_interface_startup_race.cpp index 2b813f098e..73af0c012f 100644 --- a/iceoryx_posh/test/integrationtests/test_mq_interface_startup_race.cpp +++ b/iceoryx_posh/test/integrationtests/test_mq_interface_startup_race.cpp @@ -61,6 +61,8 @@ class CMqInterfaceStartupRace_test : public Test public: virtual void SetUp() { + platform::IoxIpcChannelType::create(roudi::IPC_CHANNEL_ROUDI_NAME, IpcChannelSide::SERVER) + .and_then([this](auto& channel) { this->m_roudiQueue.emplace(std::move(channel)); }); ASSERT_THAT(m_roudiQueue.has_value(), true); } virtual void TearDown() @@ -110,8 +112,7 @@ class CMqInterfaceStartupRace_test : public Test /// @note smart_lock in combination with optional is currently not really usable std::mutex m_roudiQueueMutex; - platform::IoxIpcChannelType::result_t m_roudiQueue{ - platform::IoxIpcChannelType::create(roudi::IPC_CHANNEL_ROUDI_NAME, IpcChannelSide::SERVER)}; + optional m_roudiQueue; std::mutex m_appQueueMutex; optional m_appQueue; };