Hi

I believe I found a showstopper bug in ICS that lead my software to crash in 
many customers.

The problem is with wsoNoReceiveLoop option from socket!

In my program, I have to use wsoNoReceiveLoop in order to better process the 
data, I don´t want to process the data from the thread that fires the 
OnDataAvailable event, instead, I want to read the data from another thread... 
Thats fine... but.. I found this:

procedure TCustomWSocket.Do_FD_CLOSE(var msg: TMessage);
begin
    { In some strange situations I found that we receive a FD_CLOSE  }
    { during the connection phase, breaking the connection early !   }
    { This occurs for example after a failed FTP transfert Probably  }
    { something related to bugged winsock. Doesn't hurt with good    }
    { winsock. So let the code there !                               }
    if (FState <> wsConnecting) and (FHSocket <> INVALID_SOCKET) then begin
        { Check if we have something arrived, if yes, process it     }
        { DLR, since we are closing MAKE SURE WE LOOP in the receive }
        { function to get ALL remaining data                         }
        ASyncReceive(0, RemoveOption(FComponentOptions, wsoNoReceiveLoop));

        if not FCloseInvoked then begin
            FCloseInvoked := TRUE;
            TriggerSessionClosed(HiWord(msg.LParam));
        end;

        if FState <> wsClosed then
            Close;
    end;
end;

On routine Do_FD_CLOSE, the ASyncReceive (Which triggers my OnDataAvailable 
event handler) can be called WITHOUT the wsoNoReceiveLoop.. guess what is 
happening? My OnDataAvailable event handler DOES NOT process the data from the 
socket, and since ASyncReceive was called with wsoNoReceiveLoop it is expecting 
that my event handler DO receive the data (But it doesn´t) and then, it locks 
up on a loop!

What can I do??

Eric
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to