Revert "Update connection.cpp"

This commit is contained in:
Piotr Duszynski 2023-08-29 10:32:33 +02:00 committed by GitHub
parent a3b9c49621
commit 33bdd4ffe0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -38,7 +38,6 @@
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <linux/sockios.h>
#include <time.h>
#include "Threads.h"
#include "connection.h"
@ -128,24 +127,15 @@ void* process_connection(void *arg)
select_return = select(threads[tid].clients[i], &read_mask, (fd_set *)0, (fd_set *)0, &tv);
if (select_return < 0) /* [timeout=0, -1= ERROR] is returned */
{
n = -1;
}
else {
n = 0;
int data_to_be_read_size = 0;
if (ioctl(threads[tid].clients[i], FIONREAD, &data_to_be_read_size) < 0) {
perror("ioctl failed");
}
if (data_to_be_read_size > 0) {
buffer_size = data_to_be_read_size;
n = recv(threads[tid].clients[i], buffer, buffer_size, 0);
}
}
if(select_return <= 0) /* [timeout=0, -1= ERROR] is returned */
{
n=1;
}
else
{
buffer_size=configuration->mapPort2Buffer(original_port);
n = recv(threads[tid].clients[i],buffer,buffer_size, 0);
}
}
// deal with different recv buffer size
@ -316,4 +306,4 @@ void* process_connection(void *arg)
}
return 0;
}
}