Skip to content

Commit

Permalink
Merge tag '2024-12-13' into push-2024-12-13
Browse files Browse the repository at this point in the history
Change-Id: I327691998a17c443cbd0772fc4a1433ba868e81e
  • Loading branch information
rdementi committed Dec 14, 2024
2 parents 3b17a62 + 911b59c commit 71623ca
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions src/pcm-sensor-server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1301,10 +1301,10 @@ class Server {
SignalHandler* shi = SignalHandler::getInstance();
shi->setSocket( serverSocket_ );
shi->ignoreSignal( SIGPIPE ); // Sorry Dennis Ritchie, we do not care about this, we always check return codes
#ifndef UNIT_TEST // libFuzzer installs own signal handlers
#ifndef UNIT_TEST // libFuzzer installs own signal handlers
shi->installHandler( SignalHandler::handleSignal, SIGTERM );
shi->installHandler( SignalHandler::handleSignal, SIGINT );
#endif
#endif
}
Server( Server const & ) = delete;
Server & operator = ( Server const & ) = delete;
Expand All @@ -1320,26 +1320,26 @@ class Server {
if ( port_ == 0 )
throw std::runtime_error( "Server Constructor: No port specified." );

int sockfd = ::socket( AF_INET, SOCK_STREAM, 0 );
int sockfd = ::socket( AF_INET6, SOCK_STREAM, 0 );
if ( -1 == sockfd )
throw std::runtime_error( "Server Constructor: Can´t create socket" );

int retval = 0;

struct sockaddr_in serv;
serv.sin_family = AF_INET;
serv.sin_port = htons( port_ );
struct sockaddr_in6 serv;
serv.sin6_family = AF_INET6;
serv.sin6_port = htons( port_ );
if ( listenIP_.empty() )
serv.sin_addr.s_addr = INADDR_ANY;
serv.sin6_addr = in6addr_any;
else {
if ( 1 != ::inet_pton( AF_INET, listenIP_.c_str(), &(serv.sin_addr) ) )
if ( 1 != ::inet_pton( AF_INET6, listenIP_.c_str(), &(serv.sin6_addr) ) )
{
DBG( 3, "close clientsocketFD" );
::close(sockfd);
throw std::runtime_error( "Server Constructor: Cannot convert IP string" );
}
}
socklen_t len = sizeof( struct sockaddr_in );
socklen_t len = sizeof( struct sockaddr_in6 );
retval = ::bind( sockfd, reinterpret_cast<struct sockaddr*>(&serv), len );
if ( 0 != retval ) {
DBG( 3, "close clientsocketFD" );
Expand Down

0 comments on commit 71623ca

Please sign in to comment.