Sleep between close and data reset

This commit is contained in:
ugo
2019-03-27 11:40:53 +01:00
parent 4ebd06afbe
commit 110f2d0163
17 changed files with 6 additions and 3 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -632,9 +632,11 @@ void resetClientData(ftpDataType *data, int clientId, int isInitialization)
{
if (isInitialization != 1)
{
if (data->clients[clientId].workerData.threadIsAlive == 1)
if (data->clients[clientId].workerData.threadIsAlive == 1){
pthread_cancel(data->clients[clientId].workerData.workerThread);
usleep(10000);
printf("Thread had ben cancelled!");
}
pthread_mutex_destroy(&data->clients[clientId].conditionMutex);
pthread_cond_destroy(&data->clients[clientId].conditionVariable);

View File

@ -597,7 +597,8 @@ void closeClient(ftpDataType * ftpData, int processingSocket)
if (ftpData->clients[processingSocket].workerData.threadIsAlive == 1)
{
pthread_cancel(ftpData->clients[processingSocket].workerData.workerThread);
//printf("\nQuit command received the Pasv Thread has been cancelled.");
printf("\nQuit command received the Pasv Thread has been cancelled!!!");
usleep(10000);
}
FD_CLR(ftpData->clients[processingSocket].socketDescriptor, &ftpData->connectionData.rsetAll);