Commit 45b36615 by Michael Pastushkov

x

parent c7471de0
...@@ -356,18 +356,11 @@ int use(void) ...@@ -356,18 +356,11 @@ int use(void)
FD_ZERO(&io); FD_ZERO(&io);
FD_SET(rc.client_socket, &io); FD_SET(rc.client_socket, &io);
FD_SET(rc.remote_socket, &io); FD_SET(rc.remote_socket, &io);
//int max_fd = (rc.client_socket > rc.remote_socket) ? rc.client_socket : rc.remote_socket; int max_fd = (rc.client_socket > rc.remote_socket) ? rc.client_socket : rc.remote_socket;
/* Waiting for data */ /* Waiting for data */
// if (select(max_fd+1, &io, NULL, NULL, NULL) < 0) { if (select(max_fd+1, &io, NULL, NULL, NULL) < 0) {
// perror("use: select()"); perror("use: select()");
// break;
// }
FD_ZERO(&io);
FD_SET(rc.client_socket, &io);
if (select(rc.client_socket+1, &io, NULL, NULL, NULL) < 0) {
perror("use: select 1()");
break; break;
} }
if (FD_ISSET(rc.client_socket, &io)) if (FD_ISSET(rc.client_socket, &io))
...@@ -401,12 +394,6 @@ int use(void) ...@@ -401,12 +394,6 @@ int use(void)
printf("recv %d\t%s:%d\tpid: %d\n", count_recv, inet_ntoa(client_addr.sin_addr), ntohs(client_addr.sin_port), getpid()); printf("recv %d\t%s:%d\tpid: %d\n", count_recv, inet_ntoa(client_addr.sin_addr), ntohs(client_addr.sin_port), getpid());
} }
FD_ZERO(&io);
FD_SET(rc.remote_socket, &io);
if (select(rc.remote_socket+1, &io, NULL, NULL, NULL) < 0) {
perror("use: select 2()");
break;
}
if (FD_ISSET(rc.remote_socket, &io)) if (FD_ISSET(rc.remote_socket, &io))
{ {
/* Processing response from remote, sending it back to local */ /* Processing response from remote, sending it back to local */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment