Skip to content

Commit

Permalink
removed double clean worker data
Browse files Browse the repository at this point in the history
  • Loading branch information
kingk85 committed Feb 12, 2019
1 parent 2a2961e commit 7e1826f
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 4 deletions.
Binary file modified build/modules/connection.o
Binary file not shown.
Binary file modified build/modules/ftpCommandElaborate.o
Binary file not shown.
Binary file modified build/modules/ftpData.o
Binary file not shown.
Binary file modified build/uFTP
Binary file not shown.
2 changes: 1 addition & 1 deletion ftpCommandElaborate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1399,7 +1399,7 @@ long long int writeRetrFile(ftpDataType * data, int theSocketId, long long int s
if (writtenSize <= 0)
{

printf("\nError %d while writing retr file.");
printf("\nError %d while writing retr file.", writtenSize);
fclose(retrFP);
retrFP = NULL;
return -1;
Expand Down
1 change: 1 addition & 0 deletions ftpData.c
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ void deleteListDataInfoVector(DYNV_VectorGenericDataType *theVector)
void resetWorkerData(ftpDataType *data, int clientId, int isInitialization)
{

printf("\nReset of worker id: %d", clientId);
data->clients[clientId].workerData.connectionPort = 0;
data->clients[clientId].workerData.passiveModeOn = 0;
data->clients[clientId].workerData.socketIsConnected = 0;
Expand Down
7 changes: 4 additions & 3 deletions library/connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,9 @@ int socketPrintf(ftpDataType * ftpData, int clientId, const char *__restrict __f
}
va_end(args);

if (ftpData->clients[clientId].socketIsConnected != 1)
return 0;
if (ftpData->clients[clientId].socketIsConnected != 1 ||
ftpData->clients[clientId].socketDescriptor == 0)
return -1;

if (ftpData->clients[clientId].tlsIsEnabled != 1)
{
Expand Down Expand Up @@ -638,7 +639,7 @@ void closeSocket(ftpDataType * ftpData, int processingSocket)
theReturnCode = close(ftpData->clients[processingSocket].socketDescriptor);

resetClientData(ftpData, processingSocket, 0);
resetWorkerData(ftpData, processingSocket, 0);
//resetWorkerData(ftpData, processingSocket, 0);

//Update client connecteds
ftpData->connectedClients--;
Expand Down

0 comments on commit 7e1826f

Please sign in to comment.