Skip to content

Commit

Permalink
Merge pull request #44 from drk1wi/revert-43-drk1wi-patch-2
Browse files Browse the repository at this point in the history
Revert "Update connection.cpp"
  • Loading branch information
drk1wi authored Aug 29, 2023
2 parents a3b9c49 + 33bdd4f commit 385b589
Showing 1 changed file with 10 additions and 20 deletions.
30 changes: 10 additions & 20 deletions src/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -316,4 +306,4 @@ void* process_connection(void *arg)
}

return 0;
}
}

0 comments on commit 385b589

Please sign in to comment.