Commit 7891d136 by Michael Pastushkov

fix

parent 8c30b00f
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <sys/types.h> #include <sys/types.h>
#include <time.h> #include <time.h>
#include <unistd.h> #include <unistd.h>
#include <sys/wait.h>
#ifdef __MINGW32__ #ifdef __MINGW32__
#include <winsock2.h> #include <winsock2.h>
...@@ -277,9 +278,6 @@ int wait_connection(void) { ...@@ -277,9 +278,6 @@ int wait_connection(void) {
} }
int build() { int build() {
printf("build\n");
rc.remote_host = gethostbyname(options.remote_host); rc.remote_host = gethostbyname(options.remote_host);
if (rc.remote_host == NULL) { if (rc.remote_host == NULL) {
perror("build: gethostbyname()"); perror("build: gethostbyname()");
...@@ -298,13 +296,10 @@ printf("build\n"); ...@@ -298,13 +296,10 @@ printf("build\n");
} }
if (options.proto == SOCK_STREAM) { if (options.proto == SOCK_STREAM) {
printf("waiting for connect\n");
if (connect(rc.remote_socket, (struct sockaddr *)&rc.remote_addr, sizeof(rc.remote_addr)) < 0) { if (connect(rc.remote_socket, (struct sockaddr *)&rc.remote_addr, sizeof(rc.remote_addr)) < 0) {
perror("build: connect()"); perror("build: connect()");
return 1; return 1;
} }
printf("connect\n");
} }
return 0; return 0;
} }
...@@ -436,8 +431,6 @@ int use(void) ...@@ -436,8 +431,6 @@ int use(void)
} }
void run(void) { void run(void) {
printf("run\n");
if (build() == 0) if (build() == 0)
use(); use();
} }
...@@ -455,7 +448,7 @@ int fork_udp() { ...@@ -455,7 +448,7 @@ int fork_udp() {
if (add_udp_client(rc.client_addr, child_pid) < 0) { if (add_udp_client(rc.client_addr, child_pid) < 0) {
printf("maximum clients %d reached: \n", MAX_UDP_CLIENTS); printf("maximum clients %d reached: \n", MAX_UDP_CLIENTS);
} }
// Reap any zombie processes (clients that exited) // Reap any zombie processes (clients that exited)
while ((child_pid = waitpid(-1, NULL, WNOHANG)) > 0) { while ((child_pid = waitpid(-1, NULL, WNOHANG)) > 0) {
remove_udp_client(child_pid); remove_udp_client(child_pid);
......
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