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:
@@ -51,8 +51,7 @@ CSelect::~CSelect()
|
||||
TSelectHandle * NextHandle;
|
||||
|
||||
// Destroy handles
|
||||
while (FirstHandle)
|
||||
{
|
||||
while (FirstHandle) {
|
||||
NextHandle = FirstHandle->Next;
|
||||
delete FirstHandle;
|
||||
FirstHandle = NextHandle;
|
||||
@@ -197,8 +196,7 @@ bool CSelect::Test()
|
||||
|
||||
// Perform select
|
||||
Events = select( MaxFD, &ReadFDS, &WriteFDS, (fd_set*)NULL, &STimeout );
|
||||
if (Events < 0)
|
||||
{
|
||||
if (Events < 0) {
|
||||
if (Log) Log->Message( LogLevel, dlHigh, "%s/Selector: Select operation failed", ProcessName );
|
||||
return false;
|
||||
}
|
||||
@@ -206,11 +204,9 @@ bool CSelect::Test()
|
||||
// Check all descriptors for events
|
||||
if (Events) {
|
||||
Handle = FirstHandle;
|
||||
while (Handle)
|
||||
{
|
||||
while (Handle) {
|
||||
// Check if to remove from list
|
||||
if (!Handle->Read && !Handle->Write)
|
||||
{
|
||||
if (!Handle->Read && !Handle->Write) {
|
||||
// Update Maximum Test FD
|
||||
if (Handle->FD == MaxFD-1) {
|
||||
for (TestFD = MaxFD-1; TestFD >= 0; TestFD--) {
|
||||
@@ -232,17 +228,14 @@ bool CSelect::Test()
|
||||
Handle = *HandlePtr;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
else {
|
||||
// Check read Event
|
||||
if (FD_ISSET( Handle->FD, &ReadFDS ) && Handle->Function) {
|
||||
if (FD_ISSET( Handle->FD, &ReadFDS ) && Handle->Function)
|
||||
Handle->Function->Read( Handle->FD );
|
||||
}
|
||||
|
||||
// Check Write Event
|
||||
if (FD_ISSET( Handle->FD, &WriteFDS ) && Handle->Function) {
|
||||
if (FD_ISSET( Handle->FD, &WriteFDS ) && Handle->Function)
|
||||
Handle->Function->Write( Handle->FD );
|
||||
}
|
||||
}
|
||||
// Next
|
||||
Handle = Handle->Next;
|
||||
|
||||
Reference in New Issue
Block a user