mirror of
https://github.com/kingk85/uFTP.git
synced 2025-07-14 15:56:16 +03:00
Working on mutex
This commit is contained in:
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.
BIN
build/uFTP
BIN
build/uFTP
Binary file not shown.
@ -632,11 +632,11 @@ int parseCommandList(ftpDataType * data, int socketId)
|
|||||||
setDynamicStringDataType(&data->clients[socketId].listPath, data->clients[socketId].login.absolutePath.text, data->clients[socketId].login.absolutePath.textLen, &data->clients[socketId].memoryTable);
|
setDynamicStringDataType(&data->clients[socketId].listPath, data->clients[socketId].login.absolutePath.text, data->clients[socketId].login.absolutePath.textLen, &data->clients[socketId].memoryTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_trylock(&data->clients[socketId].workerData.conditionMutex);
|
//pthread_mutex_trylock(&data->clients[socketId].workerData.conditionMutex);
|
||||||
memset(data->clients[socketId].workerData.theCommandReceived, 0, CLIENT_COMMAND_STRING_SIZE);
|
memset(data->clients[socketId].workerData.theCommandReceived, 0, CLIENT_COMMAND_STRING_SIZE);
|
||||||
strcpy(data->clients[socketId].workerData.theCommandReceived, data->clients[socketId].theCommandReceived);
|
strcpy(data->clients[socketId].workerData.theCommandReceived, data->clients[socketId].theCommandReceived);
|
||||||
data->clients[socketId].workerData.commandReceived = 1;
|
data->clients[socketId].workerData.commandReceived = 1;
|
||||||
pthread_mutex_unlock(&data->clients[socketId].workerData.conditionMutex);
|
//pthread_mutex_unlock(&data->clients[socketId].workerData.conditionMutex);
|
||||||
pthread_cond_signal(&data->clients[socketId].workerData.conditionVariable);
|
pthread_cond_signal(&data->clients[socketId].workerData.conditionVariable);
|
||||||
return FTP_COMMAND_PROCESSED;
|
return FTP_COMMAND_PROCESSED;
|
||||||
}
|
}
|
||||||
@ -663,11 +663,11 @@ int parseCommandNlst(ftpDataType * data, int socketId)
|
|||||||
setDynamicStringDataType(&data->clients[socketId].nlistPath, data->clients[socketId].login.absolutePath.text, data->clients[socketId].login.absolutePath.textLen, &data->clients[socketId].memoryTable);
|
setDynamicStringDataType(&data->clients[socketId].nlistPath, data->clients[socketId].login.absolutePath.text, data->clients[socketId].login.absolutePath.textLen, &data->clients[socketId].memoryTable);
|
||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_trylock(&data->clients[socketId].workerData.conditionMutex);
|
//pthread_mutex_trylock(&data->clients[socketId].workerData.conditionMutex);
|
||||||
memset(data->clients[socketId].workerData.theCommandReceived, 0, CLIENT_COMMAND_STRING_SIZE);
|
memset(data->clients[socketId].workerData.theCommandReceived, 0, CLIENT_COMMAND_STRING_SIZE);
|
||||||
strcpy(data->clients[socketId].workerData.theCommandReceived, data->clients[socketId].theCommandReceived);
|
strcpy(data->clients[socketId].workerData.theCommandReceived, data->clients[socketId].theCommandReceived);
|
||||||
data->clients[socketId].workerData.commandReceived = 1;
|
data->clients[socketId].workerData.commandReceived = 1;
|
||||||
pthread_mutex_unlock(&data->clients[socketId].workerData.conditionMutex);
|
//pthread_mutex_unlock(&data->clients[socketId].workerData.conditionMutex);
|
||||||
pthread_cond_signal(&data->clients[socketId].workerData.conditionVariable);
|
pthread_cond_signal(&data->clients[socketId].workerData.conditionVariable);
|
||||||
return FTP_COMMAND_PROCESSED;
|
return FTP_COMMAND_PROCESSED;
|
||||||
}
|
}
|
||||||
@ -688,11 +688,11 @@ int parseCommandRetr(ftpDataType * data, int socketId)
|
|||||||
if (isSafePath == 1 &&
|
if (isSafePath == 1 &&
|
||||||
FILE_IsFile(data->clients[socketId].fileToRetr.text) == 1)
|
FILE_IsFile(data->clients[socketId].fileToRetr.text) == 1)
|
||||||
{
|
{
|
||||||
pthread_mutex_trylock(&data->clients[socketId].workerData.conditionMutex);
|
//pthread_mutex_trylock(&data->clients[socketId].workerData.conditionMutex);
|
||||||
memset(data->clients[socketId].workerData.theCommandReceived, 0, CLIENT_COMMAND_STRING_SIZE);
|
memset(data->clients[socketId].workerData.theCommandReceived, 0, CLIENT_COMMAND_STRING_SIZE);
|
||||||
strcpy(data->clients[socketId].workerData.theCommandReceived, data->clients[socketId].theCommandReceived);
|
strcpy(data->clients[socketId].workerData.theCommandReceived, data->clients[socketId].theCommandReceived);
|
||||||
data->clients[socketId].workerData.commandReceived = 1;
|
data->clients[socketId].workerData.commandReceived = 1;
|
||||||
pthread_mutex_unlock(&data->clients[socketId].workerData.conditionMutex);
|
//pthread_mutex_unlock(&data->clients[socketId].workerData.conditionMutex);
|
||||||
pthread_cond_signal(&data->clients[socketId].workerData.conditionVariable);
|
pthread_cond_signal(&data->clients[socketId].workerData.conditionVariable);
|
||||||
return FTP_COMMAND_PROCESSED;
|
return FTP_COMMAND_PROCESSED;
|
||||||
}
|
}
|
||||||
@ -718,11 +718,11 @@ int parseCommandStor(ftpDataType * data, int socketId)
|
|||||||
|
|
||||||
if (isSafePath == 1)
|
if (isSafePath == 1)
|
||||||
{
|
{
|
||||||
pthread_mutex_trylock(&data->clients[socketId].workerData.conditionMutex);
|
//pthread_mutex_trylock(&data->clients[socketId].workerData.conditionMutex);
|
||||||
memset(data->clients[socketId].workerData.theCommandReceived, 0, CLIENT_COMMAND_STRING_SIZE);
|
memset(data->clients[socketId].workerData.theCommandReceived, 0, CLIENT_COMMAND_STRING_SIZE);
|
||||||
strcpy(data->clients[socketId].workerData.theCommandReceived, data->clients[socketId].theCommandReceived);
|
strcpy(data->clients[socketId].workerData.theCommandReceived, data->clients[socketId].theCommandReceived);
|
||||||
data->clients[socketId].workerData.commandReceived = 1;
|
data->clients[socketId].workerData.commandReceived = 1;
|
||||||
pthread_mutex_unlock(&data->clients[socketId].workerData.conditionMutex);
|
//pthread_mutex_unlock(&data->clients[socketId].workerData.conditionMutex);
|
||||||
pthread_cond_signal(&data->clients[socketId].workerData.conditionVariable);
|
pthread_cond_signal(&data->clients[socketId].workerData.conditionVariable);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Reference in New Issue
Block a user