Skip to Content.
Sympa Menu

ndt-dev - [ndt] r322 committed - add some debug messages and a rewrite c2s accept() loop to...

Subject: NDT-DEV email list created

List archive

[ndt] r322 committed - add some debug messages and a rewrite c2s accept() loop to...


Chronological Thread 
  • From:
  • To:
  • Subject: [ndt] r322 committed - add some debug messages and a rewrite c2s accept() loop to...
  • Date: Wed, 24 Mar 2010 00:59:37 +0000

Revision: 322
Author: rcarlson501
Date: Tue Mar 23 17:58:45 2010
Log: add some debug messages and a rewrite c2s accept() loop to
detect and recover from interrupt.

rac /23/09


http://code.google.com/p/ndt/source/detail?r=322

Modified:
/trunk/src/testoptions.c

=======================================
--- /trunk/src/testoptions.c Mon Mar 22 20:56:00 2010
+++ /trunk/src/testoptions.c Tue Mar 23 17:58:45 2010
@@ -527,25 +527,32 @@
*/
log_println(1, "listening for Inet connection on testOptions->c2ssockfd, fd=%d", testOptions->c2ssockfd);

- log_println(1, "Sending 'GO' signal, to tell client to head for the next test");
+ log_println(1, "Sending 'GO' signal, to tell client %d to head for the next test", testOptions->child0);
sprintf(buff, "%d", testOptions->c2ssockport);
send_msg(ctlsockfd, TEST_PREPARE, buff, strlen(buff));

clilen = sizeof(cli_addr);
- j = 0;
- for (;;) {
- if ((recvsfd = accept(testOptions->c2ssockfd, (struct sockaddr *) &cli_addr, &clilen)) > 0)
+ /* j = 0; */
+ log_println(6, "child %d - sent c2s prepare to client", testOptions->child0);
+ for (j=0; j<5; j++) {
+ recvsfd = accept(testOptions->c2ssockfd, (struct sockaddr *) &cli_addr, &clilen);
+ if (recvsfd > 0) {
+ log_println(6, "accept() for %d completed", testOptions->child0);
break;
-
- if ((recvsfd == -1) && (errno == EINTR))
+ }
+ if ((recvsfd == -1) && (errno == EINTR)) {
+ log_println(6, "Child %d interrupted while waiting for accept() to complete",
+ testOptions->child0);
continue;
-
- sprintf(tmpstr, "------- S2C connection setup returned because (%d)", errno);
- if (get_debuglvl() > 1)
- perror(tmpstr);
- if (++j == 4)
+ }
+ log_println(6, "------- C2S connection setup for %d returned because (%d)",
+ testOptions->child0, errno);
+ if (++j == 4) {
+ log_println(6, "c2s child %d, uable to open connection, return from test", testOptions->child0);
return -2;
- }
+ }
+ }
+ log_println(6, "child %d - c2s ready for test with fd=%d", testOptions->child0, recvsfd);
src_addr = I2AddrByLocalSockFD(get_errhandle(), recvsfd, 0);
conn = web100_connection_from_socket(agent, recvsfd);

@@ -555,7 +562,8 @@
close(ctlsockfd);
close(testOptions->c2ssockfd);
close(recvsfd);
- log_println(5, "C2S test Child thinks pipe() returned fd0=%d, fd1=%d", mon_pipe1[0], mon_pipe1[1]);
+ log_println(5, "C2S test Child %d thinks pipe() returned fd0=%d, fd1=%d",
+ testOptions->child0,mon_pipe1[0], mon_pipe1[1]);
/* log_println(2, "C2S test calling init_pkttrace() with pd=0x%x", (int) &cli_addr); */
init_pkttrace(src_addr, (struct sockaddr *) &cli_addr, clilen, mon_pipe1,
device, &pair, "c2s", options->compress);
@@ -724,7 +732,7 @@
web100_log_close_write(snapArgs.log);
}

- sprintf(buff, "%6.0f kbps outbound", *c2sspd);
+ sprintf(buff, "%6.0f kbps outbound for child %d", *c2sspd, testOptions->child0);
log_println(1, "%s", buff);
/* send the c2sspd to the client */
sprintf(buff, "%0.0f", *c2sspd);


  • [ndt] r322 committed - add some debug messages and a rewrite c2s accept() loop to..., ndt, 03/23/2010

Archive powered by MHonArc 2.6.16.

Top of Page