diff --git a/dep/server.c b/dep/server.c index b1b8e63..93bb19b 100644 --- a/dep/server.c +++ b/dep/server.c @@ -186,7 +186,6 @@ void MANAGE_REQUEST(char* pRequest, int* USER_SOCKET, int* FTP_SOCKET, int* DUSE strcat(newRequest, "USER "); strcat(newRequest, userName); strcat(newRequest, "\r\n"); - printf("NEW REQ: [[%s]]\n", newRequest); strcpy(response, "USER xdrm\r\n"); } @@ -359,7 +358,7 @@ void MANAGE_RESPONSE(char* pAnswer, int* USER_SOCKET, int* FTP_SOCKET, int* DUSE /* 5. On vide le BUS DE COMMANDE du serveur FTP */ /* A. On définit un TIMEOUT (1 sec) */ - setSocketTimeout(FTP_SOCKET, 1); + setSocketTimeout(FTP_SOCKET, 0, 50); /* B. On attends une réponse */ tmp[2] = sread(FTP_SOCKET, BUFFER); diff --git a/dep/utility.c b/dep/utility.c index 80c7c75..faecd69 100644 --- a/dep/utility.c +++ b/dep/utility.c @@ -120,11 +120,11 @@ int sread(int* pSocket, char* pBuffer){ } -void setSocketTimeout(int* pSocket, const int pTimeout){ +void setSocketTimeout(int* pSocket, const int pSec, const int pUSec){ /* 1. On créé la structure contenant le timeout */ struct timeval timeout; - timeout.tv_sec = pTimeout; - timeout.tv_usec = 0; + timeout.tv_sec = pSec; + timeout.tv_usec = pUSec; setsockopt(*pSocket, SOL_SOCKET, SO_RCVTIMEO, (char*)&timeout, sizeof(struct timeval)); diff --git a/dep/utility.h b/dep/utility.h index d27ba60..b6ef223 100644 --- a/dep/utility.h +++ b/dep/utility.h @@ -31,6 +31,7 @@ void splitFtpResponse(char* pAnswer, char* ftpCode, char* ftpText); */ int indexOf(char* haystack, char needle); +void setSocketTimeout(int* pSocket, const int pSec, const int pUSec); /* read/write socket */ diff --git a/proxy_ftp.h b/proxy_ftp.h index 9d5ab2e..1847708 100644 --- a/proxy_ftp.h +++ b/proxy_ftp.h @@ -33,7 +33,7 @@ #define THR 0x40 // FILTRE pour THREADS // possibilité de cumuler les DEBUGMODES -#define DEBUGMOD SCK // REVEALS + HEADER + THREADS +#define DEBUGMOD THREADS // REVEALS + HEADER + THREADS /* vars */ diff --git a/test b/test index 5d01d9c..4c9d26d 100755 Binary files a/test and b/test differ