Skip to content

Commit

Permalink
add notification-server::trigger-discovery-notifications()
Browse files Browse the repository at this point in the history
  • Loading branch information
maloel committed Jan 16, 2024
1 parent d5df293 commit 272f72e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
2 changes: 2 additions & 0 deletions third-party/realdds/include/realdds/dds-notification-server.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ class dds_notification_server

// On-discovery notification: when a new client is detected
void add_discovery_notification( topics::flexible_msg && notification );
// Allow manual trigger of discovery
void trigger_discovery_notifications();

private:
void send_discovery_notifications();
Expand Down
19 changes: 12 additions & 7 deletions third-party/realdds/src/dds-notification-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,14 @@ dds_notification_server::dds_notification_server( std::shared_ptr< dds_publisher
_writer->on_publication_matched( [this]( PublicationMatchedStatus const & info ) {
if( info.current_count_change == 1 )
{
{
std::lock_guard< std::mutex > lock( _notification_send_mutex );
_send_init_msgs = true;
}
_send_notification_cv.notify_all();
trigger_discovery_notifications();
}
else if( info.current_count_change == -1 )
{
}
else
{
LOG_ERROR( std::to_string( info.current_count_change )
<< " is not a valid value for on_publication_matched" );
LOG_ERROR( info.current_count_change << " is not a valid value for on_publication_matched" );
}
} );

Expand Down Expand Up @@ -126,6 +121,16 @@ dds_notification_server::~dds_notification_server()
}


void dds_notification_server::trigger_discovery_notifications()
{
{
std::lock_guard< std::mutex > lock( _notification_send_mutex );
_send_init_msgs = true;
}
_send_notification_cv.notify_all();
}


void dds_notification_server::send_notification( topics::flexible_msg && notification )
{
if( ! is_running() )
Expand Down

0 comments on commit 272f72e

Please sign in to comment.