Corrections d'affichage/fonctionnement reste uniquement à gérer le "core dump" du socket de serveur FTP invalide
This commit is contained in:
parent
0e4baf6a4e
commit
fc58549913
|
@ -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);
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue