Patch from H.Nakai <nakai@neo.shinko.co.jp>: close the socket when there is a timeout

Initial
Stephane Bortzmeyer 22 years ago
parent 654c820200
commit c9595aca24

@ -734,6 +734,7 @@ main (argc, argv)
if ((errno == EINTR) && (timeout_flag)) if ((errno == EINTR) && (timeout_flag))
{ {
printf ("Timeout while connecting\n"); printf ("Timeout while connecting\n");
close (sockfd);
continue; continue;
#ifdef FLUSH_OUTPUT #ifdef FLUSH_OUTPUT
if (fflush ((FILE *) NULL) != 0) if (fflush ((FILE *) NULL) != 0)
@ -782,6 +783,7 @@ main (argc, argv)
if ((errno == EINTR) && (timeout_flag)) if ((errno == EINTR) && (timeout_flag))
{ {
printf ("Timeout while starting SSL\n"); printf ("Timeout while starting SSL\n");
close (sockfd);
continue; continue;
} }
if (verbose) if (verbose)
@ -824,6 +826,7 @@ main (argc, argv)
{ {
nr = n; nr = n;
printf ("Timeout while writing\n"); printf ("Timeout while writing\n");
close (sockfd);
continue; continue;
} }
else else
@ -839,6 +842,7 @@ main (argc, argv)
{ {
nr = n; nr = n;
printf ("Timeout while writing\n"); printf ("Timeout while writing\n");
close (sockfd);
continue; continue;
} }
else else
@ -858,6 +862,7 @@ main (argc, argv)
{ {
nr = n; nr = n;
printf ("Timeout while writing\n"); printf ("Timeout while writing\n");
close (sockfd);
continue; continue;
} }
else else
@ -1037,6 +1042,7 @@ main (argc, argv)
err_sys ("I cannot flush"); err_sys ("I cannot flush");
} }
#endif #endif
close (sockfd);
continue; continue;
} }
if (nr < 0 || nr != n) if (nr < 0 || nr != n)
@ -1056,6 +1062,7 @@ main (argc, argv)
err_sys ("I cannot flush"); err_sys ("I cannot flush");
} }
#endif #endif
close (sockfd);
continue; continue;
} }
if (nr < 0) if (nr < 0)
@ -1067,6 +1074,8 @@ main (argc, argv)
printf ("%d bytes read from server.\n", nr); printf ("%d bytes read from server.\n", nr);
} }
/* That's all, folks */ /* That's all, folks */
if (tcp)
alarm (0);
if (http) if (http)
{ {
#ifdef OPENSSL #ifdef OPENSSL
@ -1079,8 +1088,6 @@ main (argc, argv)
close (sockfd); close (sockfd);
(void) gettimeofday (&newtv, (struct timezone *) NULL); (void) gettimeofday (&newtv, (struct timezone *) NULL);
if (tcp)
alarm (0);
temp = newtv; temp = newtv;
tvsub (&temp, &oldtv); tvsub (&temp, &oldtv);
if (!timeout_flag) if (!timeout_flag)

Loading…
Cancel
Save