Skip to content

Commit

Permalink
dont use abort() when fail to open a socket.
Browse files Browse the repository at this point in the history
passert() before calling abort() waits now until the logger is done
  • Loading branch information
turleypol committed Apr 25, 2024
1 parent 0c51385 commit b27a523
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pol-core/clib/network/socketsvc.cpp
Expand Up @@ -7,6 +7,7 @@
#include <stdlib.h>

#include "logfacility.h"
#include "passert.h"
#include "socketsvc.h"
#include "strutil.h"
#include "threadhelp.h"
Expand All @@ -20,7 +21,7 @@ SocketListener::SocketListener( unsigned short port ) : _listen_sck()
if ( !_listen_sck.listen( port ) )
{
POLLOG_ERRORLN( "Unable to open listen port {}", port );
abort();
passert_always( 0 );
}
}

Expand All @@ -31,7 +32,7 @@ SocketListener::SocketListener( unsigned short port, Socket::option opt ) : _lis
if ( !_listen_sck.listen( port ) )
{
POLLOG_ERRORLN( "Unable to open listen port {}", port );
abort();
passert_always( 0 );
}
}

Expand Down
1 change: 1 addition & 0 deletions pol-core/clib/passert.cpp
Expand Up @@ -107,6 +107,7 @@ void passert_failed( const char* expr, const std::string& reason, const char* fi
if ( passert_abort )
{
POLLOG_ERRORLN( "Aborting due to assertion failure." );
Logging::global_logger->wait_for_empty_queue();
abort();
}

Expand Down

0 comments on commit b27a523

Please sign in to comment.