Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/cpp/rtps/security/SecurityManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4255,6 +4255,19 @@ void SecurityManager::resend_handshake_message_token(
remote_participant_info->event_->cancel_timer();
remote_participant_info->auth_status_ = AUTHENTICATION_FAILED;
on_validation_failed(dp_it->second->participant_data(), exception);
if (remote_participant_info->change_sequence_number_ != SequenceNumber_t::unknown())
{
participant_stateless_message_writer_history_->remove_change(
remote_participant_info->change_sequence_number_);
remote_participant_info->change_sequence_number_ = SequenceNumber_t::unknown();
// Return the handshake handle
if (remote_participant_info->handshake_handle_ != nullptr)
{
authentication_plugin_->return_handshake_handle(
remote_participant_info->handshake_handle_, exception);
remote_participant_info->handshake_handle_ = nullptr;
}
}
}
}
else
Expand Down
24 changes: 18 additions & 6 deletions test/blackbox/api/dds-pim/PubSubReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ class PubSubReader
}

#if HAVE_SECURITY
void waitAuthorized(
void wait_authorized(
std::chrono::seconds timeout = std::chrono::seconds::zero(),
unsigned int expected = 1)
{
Expand All @@ -880,16 +880,28 @@ class PubSubReader
std::cout << "Reader authorization finished..." << std::endl;
}

void waitUnauthorized()
void wait_unauthorized(
std::chrono::seconds timeout = std::chrono::seconds::zero(),
unsigned int expected = 1)
{
std::unique_lock<std::mutex> lock(mutexAuthentication_);

std::cout << "Reader is waiting unauthorization..." << std::endl;

cvAuthentication_.wait(lock, [&]() -> bool
{
return unauthorized_ > 0;
});
if (timeout == std::chrono::seconds::zero())
{
cvAuthentication_.wait(lock, [&]()
{
return unauthorized_ >= expected;
});
}
else
{
cvAuthentication_.wait_for(lock, timeout, [&]()
{
return unauthorized_ >= expected;
});
}

std::cout << "Reader unauthorization finished..." << std::endl;
}
Expand Down
24 changes: 18 additions & 6 deletions test/blackbox/api/dds-pim/PubSubWriter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -731,7 +731,7 @@ class PubSubWriter
}

#if HAVE_SECURITY
void waitAuthorized(
void wait_authorized(
std::chrono::seconds timeout = std::chrono::seconds::zero(),
unsigned int expected = 1)
{
Expand All @@ -757,16 +757,28 @@ class PubSubWriter
std::cout << "Writer authorization finished..." << std::endl;
}

void waitUnauthorized()
void wait_unauthorized(
std::chrono::seconds timeout = std::chrono::seconds::zero(),
unsigned int expected = 1)
{
std::unique_lock<std::mutex> lock(mutexAuthentication_);

std::cout << "Writer is waiting unauthorization..." << std::endl;

cvAuthentication_.wait(lock, [&]() -> bool
{
return unauthorized_ > 0;
});
if (timeout == std::chrono::seconds::zero())
{
cvAuthentication_.wait(lock, [&]()
{
return unauthorized_ >= expected;
});
}
else
{
cvAuthentication_.wait_for(lock, timeout, [&]()
{
return unauthorized_ >= expected;
});
}

std::cout << "Writer unauthorization finished..." << std::endl;
}
Expand Down
7 changes: 4 additions & 3 deletions test/blackbox/api/dds-pim/PubSubWriterReader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,8 @@ class PubSubWriterReader
do
{
wreader_.receive_one(datareader, ret);
} while (ret);
}
while (ret);
}
}

Expand Down Expand Up @@ -682,7 +683,7 @@ class PubSubWriterReader
}

#if HAVE_SECURITY
void waitAuthorized(
void wait_authorized(
unsigned int how_many = 1)
{
std::unique_lock<std::mutex> lock(mutexAuthentication_);
Expand All @@ -698,7 +699,7 @@ class PubSubWriterReader
std::cout << "WReader authorization finished..." << std::endl;
}

void waitUnauthorized(
void wait_unauthorized(
unsigned int how_many = 1)
{
std::unique_lock<std::mutex> lock(mutexAuthentication_);
Expand Down
Loading
Loading