Skip to content

Commit

Permalink
Refactor of regenerate_port (#3695)
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
Co-authored-by: Miguel Company <MiguelCompany@eprosima.com>
(cherry picked from commit e8fb3ec)

Co-authored-by: jsantiago-eProsima <90755661+jsantiago-eProsima@users.noreply.github.com>
  • Loading branch information
mergify[bot] and jsan-rt authored Jul 21, 2023
1 parent 3e8f5c7 commit f193faa
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/cpp/rtps/transport/shared_mem/SharedMemManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -783,10 +783,9 @@ class SharedMemManager :

void regenerate_port()
{
auto new_port = shared_mem_manager_->regenerate_port(global_port_, global_port_->open_mode());

auto new_listener = new_port->create_listener();

auto new_port = global_port_;
shared_mem_manager_->regenerate_port(new_port, new_port->open_mode());
auto new_listener = std::make_shared<Listener>(shared_mem_manager_, new_port);
*this = std::move(*new_listener);
}

Expand Down Expand Up @@ -930,9 +929,7 @@ class SharedMemManager :
void regenerate_port()
{
recover_blocked_processing();
auto new_port = shared_mem_manager_->regenerate_port(global_port_, open_mode_);

*this = std::move(*new_port);
shared_mem_manager_->regenerate_port(global_port_, open_mode_);
}

SharedMemManager* shared_mem_manager_;
Expand Down Expand Up @@ -1016,11 +1013,11 @@ class SharedMemManager :

private:

std::shared_ptr<Port> regenerate_port(
std::shared_ptr<SharedMemGlobal::Port> port,
void regenerate_port(
std::shared_ptr<SharedMemGlobal::Port>& port,
SharedMemGlobal::Port::OpenMode open_mode)
{
return std::make_shared<Port>(this, global_segment_.regenerate_port(port, open_mode), open_mode);
port = global_segment_.regenerate_port(port, open_mode);
}

/**
Expand Down

0 comments on commit f193faa

Please sign in to comment.