CFtpServer destructor execute before all shell thread terminated !
Status: Alpha
Brought to you by:
thebrowser
There a racing condition while closing the FTPServer while there a still user connected on.
The CFtpServer destructor is executed without waiting for all Client (thread -> Shell) is terminated.
On the Shell function, the problem usually occurred here :
pFtpServer->ClientListLock.Enter();
{
pClient->ResetDataConnection( false ); // do not wait sync on self
if( pClient->bIsCtrlCanalOpen == true ) {
pClient->ResetTimeout();
} else
delete pClient;
}
pFtpServer->ClientListLock.Leave(); // Here, as the pFtpServer object has been destructed !
There an error in the code of my last message and as I CANNOT edit my own message, I will describe the problem again here + how to correct it.
There a racing condition while closing the FTPServer while there a still user connected on.
The CFtpServer destructor is executed without waiting for all Client (thread -> Shell) thread terminated.
On the Shell function, the problem usually occurred here :
To correct the problem, simply remove the lock on ClientListLock object. It is not useful as we delete and object that has been already detached from this list and we don't modify the list itself. So :