debug print

This commit is contained in:
root
2024-04-13 16:08:40 +02:00
parent d260b0f6b6
commit de8e6fbbc7
2 changed files with 8 additions and 4 deletions

View File

@ -503,11 +503,12 @@ int parseCommandPasv(ftpDataType *data, int socketId)
data->clients[socketId].workerData.passiveModeOn = 1; data->clients[socketId].workerData.passiveModeOn = 1;
data->clients[socketId].workerData.extendedPassiveModeOn = 0; data->clients[socketId].workerData.extendedPassiveModeOn = 0;
data->clients[socketId].workerData.activeModeOn = 0; data->clients[socketId].workerData.activeModeOn = 0;
returnCode = pthread_create(&data->clients[socketId].workerData.workerThread, NULL, connectionWorkerHandle, (void *)&data->clients[socketId].clientProgressiveNumber); returnCode = pthread_create(&data->clients[socketId].workerData.workerThread, NULL, connectionWorkerHandle, (void *)&data->clients[socketId].clientProgressiveNumber);
if (returnCode != 0) if (returnCode != 0)
{ {
// my_printf("\nError in pthread_create %d", returnCode); my_printf("\nError in pthread_create %d", returnCode);
return FTP_COMMAND_PROCESSED_WRITE_ERROR; return FTP_COMMAND_PROCESSED_WRITE_ERROR;
} }

View File

@ -128,7 +128,7 @@ void *connectionWorkerHandle(void * socketId)
ftpData.clients[theSocketId].workerData.threadHasBeenCreated = 1; ftpData.clients[theSocketId].workerData.threadHasBeenCreated = 1;
int returnCode; int returnCode;
//my_printf("\nWORKER CREATED!"); my_printf("\nWORKER CREATED!");
//Passive data connection mode //Passive data connection mode
if (ftpData.clients[theSocketId].workerData.passiveModeOn == 1) if (ftpData.clients[theSocketId].workerData.passiveModeOn == 1)
@ -150,7 +150,7 @@ void *connectionWorkerHandle(void * socketId)
if (ftpData.clients[theSocketId].workerData.passiveListeningSocket == -1) if (ftpData.clients[theSocketId].workerData.passiveListeningSocket == -1)
{ {
ftpData.clients[theSocketId].closeTheClient = 1; ftpData.clients[theSocketId].closeTheClient = 1;
//my_printf("\n Closing the client 1"); my_printf("\n Closing the client 1");
pthread_exit(NULL); pthread_exit(NULL);
} }
@ -163,13 +163,14 @@ void *connectionWorkerHandle(void * socketId)
else else
{ {
returnCode = -1; returnCode = -1;
my_printf("\nUnknown passive state, should be PASV or EPSV");
perror("Unknown passive state, should be PASV or EPSV"); perror("Unknown passive state, should be PASV or EPSV");
} }
if (returnCode <= 0) if (returnCode <= 0)
{ {
ftpData.clients[theSocketId].closeTheClient = 1; ftpData.clients[theSocketId].closeTheClient = 1;
//my_printf("\n Closing the client 2"); my_printf("\n Closing the client 2");
pthread_exit(NULL); pthread_exit(NULL);
} }
@ -211,6 +212,8 @@ void *connectionWorkerHandle(void * socketId)
pthread_exit(NULL); pthread_exit(NULL);
} }
} }
else
my_printf("\n Socket already connected");
} }
else if (ftpData.clients[theSocketId].workerData.activeModeOn == 1) else if (ftpData.clients[theSocketId].workerData.activeModeOn == 1)
{ {