Quote
void CUrlClient::OnSocketConnected(int nErrorCode)
{
if (nErrorCode == 0)
{
ConnectionEstablished(); // >>> WiZaRd - We connected successfully!
SetDownStartTime(); //>>> WiZaRd - fix download time
SendHttpBlockRequests();
}
}
{
if (nErrorCode == 0)
{
ConnectionEstablished(); // >>> WiZaRd - We connected successfully!
SetDownStartTime(); //>>> WiZaRd - fix download time
SendHttpBlockRequests();
}
}
This was rather easy to find out as we have a nice ASSERT in CUpDownClient::Disconnected() which fires on that occasion: ASSERT( m_nConnectingState == CCS_NONE );
The issue is caused by the following scenario:
In CUrlClient::Connect() we wait for the socket to connect and start downloading afterwards but we don't update the client instance once the socket actually connected.
CClientList::ProcessConnectingClientsList() will thus close the socket and terminate the download as it is indicated to be in connecting state for too long while the socket is actually connected "working" properly.
IMHO the fix is valid but there may be a more proper way to fix that problem