Skip to content

Commit

Permalink
fixup! rename to (dds_)network_adapter_watcher
Browse files Browse the repository at this point in the history
  • Loading branch information
maloel committed Sep 11, 2024
1 parent 965908c commit d109d38
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions third-party/rsutils/src/network-adapter-watcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,20 @@ class network_adapter_watcher_singleton
NotifyAddrChange( &h_file, &overlap );
// If multiple objects become signaled, the function returns the index of the first handle in the
// array whose object was signaled:
if( WAIT_OBJECT_0
== WaitForMultipleObjects( n_handles, handles, FALSE /*wait-for-all*/, INFINITE ) )
auto result = WaitForMultipleObjects( n_handles, handles, FALSE /*wait-for-all*/, INFINITE );
if( WAIT_OBJECT_0 == result )
break; // we're done
LOG_DEBUG( "network adapter changes detected!" );
callbacks.raise();
if( ( WAIT_OBJECT_0 + 1 ) == result )
{
LOG_DEBUG( "network adapter changes detected!" );
callbacks.raise();
}
else
{
auto last_error = GetLastError();
LOG_ERROR( "Network adapter wait failed (" << result << "); GetLastError is " << last_error );
break;
}
}

LOG_DEBUG( "exiting network adapter watcher" );
Expand Down Expand Up @@ -122,7 +131,7 @@ class network_adapter_watcher_singleton

char buf[4096];
struct sockaddr_nl snl;
iovec iov = { buf, sizeof buf };
iovec iov = { buf, sizeof( buf ) };
msghdr msg = { (void *)&snl, sizeof snl, &iov, 1, NULL, 0, 0 };
int status = recvmsg( _socket, &msg, 0 );
if( status < 0 )
Expand Down

0 comments on commit d109d38

Please sign in to comment.