Resolve fix:

- CancelResolv(): Standard function to cancel name resolve requests
  - Allow Resolv request to complete if not cancelled
  - Clear memory if resolve request cancelled
- getaddrinfo_a(): still leaks if thread not closed
Other:
- Code clean up
This commit is contained in:
2022-07-21 12:08:22 +02:00
parent 1c81055eea
commit fd3738567a
6 changed files with 85 additions and 90 deletions

View File

@@ -65,8 +65,7 @@ void SignalTerminate( int sig )
char SigName[10];
// Determine signal name
switch (sig)
{
switch (sig) {
case SIGHUP : strcpy( SigName, "SIGHUP " ); break;
case SIGINT : strcpy( SigName, "SIGINT " ); break;
case SIGQUIT : strcpy( SigName, "SIGQUIT" ); break;
@@ -82,36 +81,30 @@ void SignalTerminate( int sig )
std::cerr << std::endl << ProcessName << ": ***********************************" << std::endl;
// Create Application->Log Entry
if (Application->Log)
{
if (Application->Log) {
Application->Log->Message( dlLow, dlLow, "%s: ** %s signal received [%d] **", ProcessName, SigName, TermCount );
// Check for Terminate Limit
if (TermCount < MaxTermCount) {
if (TermCount < MaxTermCount)
Application->Log->Message( dlLow, dlLow, "%s: ** Terminating normally... **", ProcessName );
} else {
else
Application->Log->Message( dlLow, dlLow, "%s: ** Terminating immediately! **", ProcessName );
}
}
else
{
else {
std::cerr << ProcessName << ": ** " << SigName << " signal received [" << TermCount << "] **" << std::endl;
// Check for Terminate Limit
if (TermCount < MaxTermCount) {
if (TermCount < MaxTermCount)
std::cerr << ProcessName << ": ** Terminating normally... **" << std::endl;
} else {
else
std::cerr << ProcessName << ": ** Terminating immediately! **" << std::endl;
}
}
std::cerr << ProcessName << ": ***********************************" << std::endl << std::endl;
// Check for Terminate Limit
if (TermCount >= MaxTermCount) {
if (TermCount >= MaxTermCount)
exit( sig );
}
return;
}//---------------------------------------------------------------------------
}
//---------------------------------------------------------------------------
// Signal Handler to terminate program immediately
void SignalAbort( int sig )
@@ -119,8 +112,7 @@ void SignalAbort( int sig )
char SigName[10];
// Determine Signal name
switch (sig)
{
switch (sig) {
case SIGABRT : strcpy( SigName, "SIGABRT" ); break;
case SIGFPE : strcpy( SigName, "SIGFPE " ); break;
case SIGILL : strcpy( SigName, "SIGILL " ); break;