Skip to Content.
Sympa Menu

ndt-dev - [ndt] r317 committed - Updates to server code...

Subject: NDT-DEV email list created

List archive

[ndt] r317 committed - Updates to server code...


Chronological Thread 
  • From:
  • To:
  • Subject: [ndt] r317 committed - Updates to server code...
  • Date: Sun, 21 Mar 2010 18:05:28 +0000

Revision: 317
Author: rcarlson501
Date: Sun Mar 21 11:04:42 2010
Log: Updates to server code

catch/report sig13, sigpipe

Remove alarm() timers around individual tests

rac 3/21/10


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

Modified:
/trunk/Applet/Tcpbw100.java
/trunk/src/fakewww.c
/trunk/src/test_sfw_srv.c
/trunk/src/testoptions.c
/trunk/src/web100-util.c
/trunk/src/web100srv.c
/trunk/src/web100srv.h

=======================================
--- /trunk/Applet/Tcpbw100.java Mon Mar 8 14:34:02 2010
+++ /trunk/Applet/Tcpbw100.java Sun Mar 21 11:04:42 2010
@@ -829,16 +829,17 @@
emailText = "Checking for Middleboxes . . . . . . . . . . . . . . . . . . ";

if (ctl.recv_msg(msg) != 0) {
- //errmsg = "Protocol error! Expected prepare, got: " + new String(msg.body) + "instead\n";
+ errmsg = "Protocol error! Expected 'prepare', got: 0x" +
+ Integer.parseInt(new String(msg.body), 16) + "instead\n";
// XXX JZ: 03/08/2010
// Reverting to old error message.
- errmsg = "Protocol error! Expected prepare, received something else.\n";
+ // errmsg = "Protocol error! Expected prepare, received something else.\n";
return true;
}
if (msg.type != TEST_PREPARE) {
errmsg = "Middlebox test: Received wrong type of the message\n";
if (msg.type == MSG_ERROR) {
- errmsg += "ERROR MSG: " + new String(msg.body) + "\n";
+ errmsg += "ERROR MSG: " + Integer.parseInt(new String(msg.body), 16) + "\n";
}
return true;
}
@@ -882,16 +883,17 @@
s2cspd = ((8.0 * bytes) / 1000) / t;

if (ctl.recv_msg(msg) != 0) {
- //errmsg = "Protocol error! Expected test data, got: " + new String(msg.body) + "instead\n";
+ errmsg = "Protocol error! Expected 'test data', got: 0x" +
+ Integer.parseInt(new String(msg.body), 16) + "instead\n";
// XXX JZ: 03/08/2010
// Reverting to old error message.
- errmsg = "Protocol error! Expected test data, received something else.\n";
+ // errmsg = "Protocol error! Expected test data, received something else.\n";
return true;
}
if (msg.type != TEST_MSG) {
errmsg = "Middlebox test results: Received wrong type of the message\n";
if (msg.type == MSG_ERROR) {
- errmsg += "ERROR MSG: " + new String(msg.body) + "\n";
+ errmsg += "ERROR MSG: " + Integer.parseInt(new String(msg.body), 16) + "\n";
}
return true;
}
@@ -924,16 +926,17 @@
in2Socket.close();

if (ctl.recv_msg(msg) != 0) {
- //errmsg = "Protocol error! Expected finalize, got: " + new String(msg.body) + "instead\n";
+ errmsg = "Protocol error! Expected 'finalize', got: 0x" +
+ Integer.parseInt(new String(msg.body), 16) + "instead\n";
// XXX JZ: 03/08/2010
// Reverting to old error message.
- errmsg = "Protocol error! Expected finalize, received something else.\n";
+ // errmsg = "Protocol error! Expected finalize, received something else.\n";
return true;
}
if (msg.type != TEST_FINALIZE) {
errmsg = "Middlebox test: Received wrong type of the message\n";
if (msg.type == MSG_ERROR) {
- errmsg += "ERROR MSG: " + new String(msg.body) + "\n";
+ errmsg += "ERROR MSG: " + Integer.parseInt(new String(msg.body), 16) + "\n";
}
return true;
}
@@ -954,16 +957,17 @@
emailText = "checking for firewalls . . . . . . . . . . . . . . . . . . . ";

if (ctl.recv_msg(msg) != 0) {
- //errmsg = "Protocol error! Expected prepare, got: " + new String(msg.body) + "instead\n";
+ errmsg = "Protocol error! Expected 'prepare', got: 0x" +
+ Integer.parseInt(new String(msg.body), 16) + "instead\n";
// XXX JZ: 03/08/2010
// Reverting to old error message.
- errmsg = "Protocol error! Expected prepare, received something else.\n";
+ // errmsg = "Protocol error! Expected prepare, received something else.\n";
return true;
}
if (msg.type != TEST_PREPARE) {
errmsg = "Simple firewall test: Received wrong type of the message\n";
if (msg.type == MSG_ERROR) {
- errmsg += "ERROR MSG: " + new String(msg.body) + "\n";
+ errmsg += "ERROR MSG: " + Integer.parseInt(new String(msg.body), 16) + "\n";
}
return true;
}
@@ -1003,16 +1007,17 @@
ctl.send_msg(TEST_MSG, Integer.toString(srvSocket.getLocalPort()).getBytes());

if (ctl.recv_msg(msg) != 0) {
- //errmsg = "Protocol error! Expected port number, got: " + new String(msg.body) + "instead\n";
+ errmsg = "Protocol error! Expected 'port number', got: 0x" +
+ Integer.parseInt(new String(msg.body), 16) + "instead\n";
// XXX JZ: 03/08/2010
// Reverting to old error message.
- errmsg = "Protocol error! Expected port number, received something else.\n";
+ // errmsg = "Protocol error! Expected port number, received something else.\n";
return true;
}
if (msg.type != TEST_START) {
errmsg = "Simple firewall test: Received wrong type of the message\n";
if (msg.type == MSG_ERROR) {
- errmsg += "ERROR MSG: " + new String(msg.body) + "\n";
+ errmsg += "ERROR MSG: " + Integer.parseInt(new String(msg.body), 16) + "\n";
}
return true;
}
@@ -1032,16 +1037,17 @@
}

if (ctl.recv_msg(msg) != 0) {
- //errmsg = "Protocol error! Expected test data, got: " + new String(msg.body) + "instead\n";
+ errmsg = "Protocol error! Expected 'test data', got: 0x" +
+ Integer.parseInt(new String(msg.body), 16) + "instead\n";
// XXX JZ: 03/08/2010
// Reverting to old error message.
- errmsg = "Protocol error! Expected test data, received something else.\n";
+ // errmsg = "Protocol error! Expected test data, received something else.\n";
return true;
}
if (msg.type != TEST_MSG) {
errmsg = "Simple firewall test: Received wrong type of the message\n";
if (msg.type == MSG_ERROR) {
- errmsg += "ERROR MSG: " + new String(msg.body) + "\n";
+ errmsg += "ERROR MSG: " + Integer.parseInt(new String(msg.body), 16) + "\n";
}
return true;
}
@@ -1050,16 +1056,17 @@
osfwTest.finalize();

if (ctl.recv_msg(msg) != 0) {
- //errmsg = "Protocol error! Expected finalize, got: " + new String(msg.body) + "instead\n";
+ errmsg = "Protocol error! Expected 'finalize', got: 0x" +
+ Integer.parseInt(new String(msg.body), 16) + "instead\n";
// XXX JZ: 03/08/2010
// Reverting to old error message.
- errmsg = "Protocol error! Expected finalize, received something else.\n";
+ // errmsg = "Protocol error! Expected finalize, received something else.\n";
return true;
}
if (msg.type != TEST_FINALIZE) {
errmsg = "Simple firewall test: Received wrong type of the message\n";
if (msg.type == MSG_ERROR) {
- errmsg += "ERROR MSG: " + new String(msg.body) + "\n";
+ errmsg += "ERROR MSG: " + Integer.parseInt(new String(msg.body), 16) + "\n";
}
return true;
}
@@ -1082,16 +1089,17 @@
emailText += "running 10s outbound test (client-to-server [C2S]) . . . . . ";

if (ctl.recv_msg(msg) != 0) {
- //errmsg = "Protocol error! Expected prepare, got: " + new String(msg.body) + "instead\n";
+ errmsg = "Protocol error! Expected 'prepare', got: 0x" +
+ Integer.parseInt(new String(msg.body), 16) + "instead\n";
// XXX JZ: 03/08/2010
// Reverting to old error message.
- errmsg = "Protocol error! Expected prepare, received something else.\n";
+ // errmsg = "Protocol error! Expected prepare, received something else.\n";
return true;
}
if (msg.type != TEST_PREPARE) {
errmsg = "C2S throughput test: Received wrong type of the message\n";
if (msg.type == MSG_ERROR) {
- errmsg += "ERROR MSG: " + new String(msg.body) + "\n";
+ errmsg += "ERROR MSG: " + Integer.parseInt(new String(msg.body), 16) + "\n";
}
return true;
}
@@ -1120,16 +1128,17 @@
// wait here for signal from server application
// This signal tells the client to start pumping out data
if (ctl.recv_msg(msg) != 0) {
- //errmsg = "Protocol error! Expected start signal, got: " + new String(msg.body) + "instead\n";
+ errmsg = "Protocol error! Expected 'start signal', got: 0x" +
+ Integer.parseInt(new String(msg.body), 16) + "instead\n";
// XXX JZ: 03/08/2010
// Reverting to old error message.
- errmsg = "Protocol error! Expected start signal, received something else.\n";
+ // errmsg = "Protocol error! Expected start signal, received something else.\n";
return true;
}
if (msg.type != TEST_START) {
errmsg = "C2S throughput test: Received wrong type of the message\n";
if (msg.type == MSG_ERROR) {
- errmsg += "ERROR MSG: " + new String(msg.body) + "\n";
+ errmsg += "ERROR MSG: " + Integer.parseInt(new String(msg.body), 16) + "\n";
}
return true;
}
@@ -1169,16 +1178,17 @@
c2sspd = ((8.0 * pkts * lth) / 1000) / t;
/* receive the c2sspd from the server */
if (ctl.recv_msg(msg) != 0) {
- //errmsg = "Protocol error! Expected test data, got: " + new String(msg.body) + "instead\n";
+ errmsg = "Protocol error! Expected 'test data', got: 0x" +
+ Integer.parseInt(new String(msg.body), 16) + "instead\n";
// XXX JZ: 03/08/2010
// Reverting to old error message.
- errmsg = "Protocol error! Expected test data, received something else.\n";
+ // errmsg = "Protocol error! Expected test data, received something else.\n";
return true;
}
if (msg.type != TEST_MSG) {
errmsg = "C2S throughput test: Received wrong type of the message\n";
if (msg.type == MSG_ERROR) {
- errmsg += "ERROR MSG: " + new String(msg.body) + "\n";
+ errmsg += "ERROR MSG: " + Integer.parseInt(new String(msg.body), 16) + "\n";
}
return true;
}
@@ -1200,16 +1210,17 @@
pub_c2sspd = sc2sspd;

if (ctl.recv_msg(msg) != 0) {
- //errmsg = "Protocol error! Expected finalize, got: " + new String(msg.body) + "instead\n";
+ errmsg = "Protocol error! Expected 'finalize', got: 0x" +
+ Integer.parseInt(new String(msg.body), 16) + "instead\n";
// XXX JZ: 03/08/2010
// Reverting to old error message.
- errmsg = "Protocol error! Expected finalize, received something else.\n";
+ // errmsg = "Protocol error! Expected finalize, received something else.\n";
return true;
}
if (msg.type != TEST_FINALIZE) {
errmsg = "C2S throughput test: Received wrong type of the message\n";
if (msg.type == MSG_ERROR) {
- errmsg += "ERROR MSG: " + new String(msg.body) + "\n";
+ errmsg += "ERROR MSG: " + Integer.parseInt(new String(msg.body), 16) + "\n";
}
return true;
}
@@ -1228,16 +1239,17 @@
emailText += "running 10s inbound test (server-to-client [S2C]) . . . . . . ";

if (ctl.recv_msg(msg) != 0) {
- //errmsg = "Protocol error! Expected prepare, got: " + new String(msg.body) + "instead\n";
+ errmsg = "Protocol error! Expected 'prepare', got: 0x" +
+ Integer.parseInt(new String(msg.body), 16) + "instead\n";
// XXX JZ: 03/08/2010
// Reverting to old error message.
- errmsg = "Protocol error! Expected prepare, received something else.\n";
+ // errmsg = "Protocol error! Expected prepare, received something else.\n";
return true;
}
if (msg.type != TEST_PREPARE) {
errmsg = "C2S throughput test: Received wrong type of the message\n";
if (msg.type == MSG_ERROR) {
- errmsg += "ERROR MSG: " + new String(msg.body) + "\n";
+ errmsg += "ERROR MSG: " + Integer.parseInt(new String(msg.body), 16) + "\n";
}
return true;
}
@@ -1264,16 +1276,17 @@

// wait here for signal from server application
if (ctl.recv_msg(msg) != 0) {
- //errmsg = "Protocol error! Expected start signal, got: " + new String(msg.body) + "instead\n";
+ errmsg = "Protocol error! Expected 'start signal', got: 0x" +
+ Integer.parseInt(new String(msg.body), 16) + "instead\n";
// XXX JZ: 03/08/2010
// Reverting to old error message.
- errmsg = "Protocol error! Expected start signal, received something else.\n";
+ // errmsg = "Protocol error! Expected start signal, received something else.\n";
return true;
}
if (msg.type != TEST_START) {
errmsg = "S2C throughput test: Received wrong type of the message\n";
if (msg.type == MSG_ERROR) {
- errmsg += "ERROR MSG: " + new String(msg.body) + "\n";
+ errmsg += "ERROR MSG: " + Integer.parseInt(new String(msg.body), 16) + "\n";
}
return true;
}
@@ -1296,16 +1309,17 @@

/* receive the s2cspd from the server */
if (ctl.recv_msg(msg) != 0) {
- //errmsg = "Protocol error! Expected test data, got: " + new String(msg.body) + "instead\n";
+ errmsg = "Protocol error! Expected 'test data', got: 0x" +
+ Integer.parseInt(new String(msg.body), 16) + "instead\n";
// XXX JZ: 03/08/2010
// Reverting to old error message.
- errmsg = "Protocol error! Expected test data, received something else.\n";
+ // errmsg = "Protocol error! Expected test data, received something else.\n";
return true;
}
if (msg.type != TEST_MSG) {
errmsg = "S2C throughput test: Received wrong type of the message\n";
if (msg.type == MSG_ERROR) {
- errmsg += "ERROR MSG: " + new String(msg.body) + "\n";
+ errmsg += "ERROR MSG: " + Integer.parseInt(new String(msg.body), 16) + "\n";
}
return true;
}
@@ -1354,10 +1368,11 @@
try {
for (;;) {
if (ctl.recv_msg(msg) != 0) {
- //errmsg = "Protocol error! Expected finalize, got: " + new String(msg.body) + "instead\n";
+ errmsg = "Protocol error! Expected 'finalize', got: 0x" +
+ Integer.parseInt(new String(msg.body), 16) + "instead\n";
// XXX JZ: 03/08/2010
// Reverting to old error message.
- errmsg = "Protocol error! Expected finalize, received something else.\n";
+ // errmsg = "Protocol error! Expected finalize, received something else.\n";
return true;
}
if (msg.type == TEST_FINALIZE) {
@@ -1366,7 +1381,7 @@
if (msg.type != TEST_MSG) {
errmsg = "S2C throughput test: Received wrong type of the message\n";
if (msg.type == MSG_ERROR) {
- errmsg += "ERROR MSG: " + new String(msg.body) + "\n";
+ errmsg += "ERROR MSG: " + Integer.parseInt(new String(msg.body), 16) + "\n";
}
return true;
}
@@ -1433,7 +1448,8 @@
return;
} catch (IOException e) {
System.err.println("Couldn't get the connection to: " + host + " " +ctlport);
- errmsg = "Server process not running: start web100srv process on remote server (" + host + ":" + ctlport + ")\n" ;
+ errmsg = "Server process not running: start web100srv process on remote server (" +
+ host + ":" + ctlport + ")\n" ;
failed = true;
return;
}
@@ -1460,10 +1476,11 @@

for (;;) {
if (ctl.recv_msg(msg) != 0) {
- //errmsg = "Protocol error! Expected wait time, got: " + new String(msg.body) + "instead\n";
+ errmsg = "Protocol error! Expected 'wait time', got: 0x" +
+ Integer.parseInt(new String(msg.body), 16) +
"instead\n";
// XXX JZ: 03/08/2010
// Reverting to old error message.
- errmsg = "Protocol error! Expected wait time, received something else.\n";
+ // errmsg = "Protocol error! Expected wait time, received something else.\n";
failed = true;
return;
}
@@ -1508,10 +1525,11 @@
ff.toBack();

if (ctl.recv_msg(msg) != 0) {
- //errmsg = "Protocol error! Expected hello signal, got: " + new String(msg.body) + "instead\n";
+ errmsg = "Protocol error! Expected 'hello signal', got: 0x" +
+ Integer.parseInt(new String(msg.body), 16) + "instead\n";
// XXX JZ: 03/08/2010
// Reverting to old error message.
- errmsg = "Protocol error! Expected hello signal, received something else.\n";
+ // errmsg = "Protocol error! Expected hello signal, received something else.\n";
failed = true;
return;
}
@@ -1530,10 +1548,11 @@
System.out.println("Server version: " + vVersion.substring(1));

if (ctl.recv_msg(msg) != 0) {
- //errmsg = "Protocol error! Expected server version info, got: " + new String(msg.body) + "instead\n";
+ errmsg = "Protocol error! Expected 'server version info', got: 0x" +
+ Integer.parseInt(new String(msg.body), 16) + "instead\n";
// XXX JZ: 03/08/2010
// Reverting to old error message.
- errmsg = "Protocol error! Expected server version info, received something else.\n";
+ // errmsg = "Protocol error! Expected server version info, received something else.\n";
failed = true;
return;
}
@@ -1608,10 +1627,11 @@
try {
for (;;) {
if (ctl.recv_msg(msg) != 0) {
- //errmsg = "Protocol error! Expected test results, got: " + new String(msg.body) + "instead\n";
+ errmsg = "Protocol error! Expected 'test results', got: 0x" +
+ Integer.parseInt(new String(msg.body), 16) +
"instead\n";
// XXX JZ: 03/08/2010
// Reverting to old error message.
- errmsg = "Protocol error! Expected test results, received something else.\n";
+ // errmsg = "Protocol error! Expected test results, received something else.\n";
failed = true;
return;
}
=======================================
--- /trunk/src/fakewww.c Mon Apr 6 12:39:53 2009
+++ /trunk/src/fakewww.c Sun Mar 21 11:04:42 2010
@@ -70,7 +70,7 @@
"/"ADMINFILE, "/Admin.class", "/tr.sh", "/traceroute.pl",
"/Tcpbw100$MyTextPane.class",
"/Tcpbw100$Protocol.class", "/Tcpbw100$StatusPanel.class",
"/Tcpbw100$3.class",
"/Tcpbw100$OsfwWorker.class", "/Tcpbw100$Message.class",
"/Tcpbw100$StatusPanel$1.class",
- "/Tcpbw100$clsFrame$1.class", "/Tcpbw100$TestWorker.class", 0};
+ "/Tcpbw100$clsFrame$1.class", "/Tcpbw100$TestWorker.class", "/crossdomain.xml", 0};

typedef struct allowed {
char* filename;
=======================================
--- /trunk/src/test_sfw_srv.c Tue Oct 13 07:49:45 2009
+++ /trunk/src/test_sfw_srv.c Sun Mar 21 11:04:42 2010
@@ -19,7 +19,7 @@
static pthread_mutex_t mainmutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t maincond = PTHREAD_COND_INITIALIZER;
static I2Addr sfwcli_addr = NULL;
-static int testTime = 30;
+static int testTime = 3;
static int toWait = 1;
static pthread_t threadId = -1;

@@ -33,7 +33,7 @@
catch_alrm(int signo)
{
if (signo == SIGALRM) {
- log_println(1, "SIGALRM was caught");
+ log_println(1, "SFW - SIGALRM was caught");
if (threadId != -1) { /* we forward the signal to the osfw thread */
pthread_kill(threadId, SIGALRM);
threadId =-1;
@@ -59,7 +59,7 @@
memset(&new, 0, sizeof(new));
new.sa_handler = catch_alrm;
sigaction(SIGALRM, &new, &old);
- alarm(testTime + 1);
+ alarm(testTime);
if (CreateConnectSocket(&sfwsock, NULL, sfwcli_addr, 0, 0) == 0) {
send_msg(sfwsock, TEST_MSG, "Simple firewall test", 20);
}
@@ -127,7 +127,7 @@

if (options->sfwopt) {
setCurrentTest(TEST_SFW);
- log_println(1, " <-- Simple firewall test -->");
+ log_println(1, " <-- %d - Simple firewall test -->", options->child0);

sfwsrv_addr = CreateListenSocket(NULL, "0", conn_options, 0);
if (sfwsrv_addr == NULL) {
@@ -154,8 +154,8 @@
maxRTO = atoi(web100_value_to_text(web100_get_var_type(var), buff));
if (maxRTT > maxRTO)
maxRTO = maxRTT;
- if (((((double) maxRTO) / 1000.0) + 1) < 30.0)
- testTime = ((double) maxRTO) / 1000.0 + 1;
+ if ((((double) maxRTO) / 1000.0) < 3.0)
+ testTime = (((double) maxRTO) / 1000.0) * 4 ;
}
else {
log_println(0, "Simple firewall test: Cannot find connection");
@@ -164,7 +164,7 @@
I2AddrFree(sfwsrv_addr);
return -1;
}
- log_println(1, " -- time: %d", testTime);
+ log_println(1, " -- SFW time: %d", testTime);

sprintf(buff, "%d %d", sfwsockport, testTime);
send_msg(ctlsockfd, TEST_PREPARE, buff, strlen(buff));
@@ -214,7 +214,7 @@

FD_ZERO(&fds);
FD_SET(sfwsockfd, &fds);
- sel_tv.tv_sec = testTime + 1;
+ sel_tv.tv_sec = testTime;
sel_tv.tv_usec = 0;
switch (select(sfwsockfd+1, &fds, NULL, NULL, &sel_tv)) {
case -1:
=======================================
--- /trunk/src/testoptions.c Sun Feb 28 11:29:32 2010
+++ /trunk/src/testoptions.c Sun Mar 21 11:04:42 2010
@@ -282,7 +282,7 @@

if (options->midopt) {
setCurrentTest(TEST_MID);
- log_println(1, " <-- Middlebox test -->");
+ log_println(1, " <-- %d - Middlebox test -->", options->child0);
strcpy(listenmidport, PORT3);

if (options->midsockport) {
@@ -469,7 +469,7 @@

if (testOptions->c2sopt) {
setCurrentTest(TEST_C2S);
- log_println(1, " <-- C2S throughput test -->");
+ log_println(1, " <-- %d - C2S throughput test -->", testOptions->child0);
strcpy(listenc2sport, PORT2);

if (testOptions->c2ssockport) {
@@ -865,7 +865,7 @@

if (testOptions->s2copt) {
setCurrentTest(TEST_S2C);
- log_println(1, " <-- S2C throughput test -->");
+ log_println(1, " <-- %d - S2C throughput test -->", testOptions->child0);
strcpy(listens2cport, PORT4);

if (testOptions->s2csockport) {
@@ -1111,7 +1111,7 @@
pthread_mutex_unlock(&mainmutex);
}

- alarm(20);
+ /* alarm(20); */
t = secs();
s = t + 10.0;

=======================================
--- /trunk/src/web100-util.c Sun Feb 28 12:04:47 2010
+++ /trunk/src/web100-util.c Sun Mar 21 11:04:42 2010
@@ -258,7 +258,7 @@
sprintf(web_vars[i].value, "%s", web100_value_to_text(web100_get_var_type(var), buf));
sprintf(line, "%s: %d\n", web_vars[i].name, atoi(web_vars[i].value));
send_msg(ctlsock, TEST_MSG, line, strlen(line));
- log_print(6, "%s", line);
+ log_print(9, "%s", line);
}
log_println(6, "S2C test - Send web100 data to client pid=%d", getpid());
return(0);
=======================================
--- /trunk/src/web100srv.c Sun Feb 28 11:51:47 2010
+++ /trunk/src/web100srv.c Sun Mar 21 11:04:42 2010
@@ -480,6 +480,7 @@
getpid());
fclose(fp);
}
+ sig13 = 1;
break;

case SIGHUP:
@@ -1672,6 +1673,7 @@
waiting = 0;
loopcnt = 0;
head_ptr = NULL;
+ sig13 = 0;
sig17 = 0;
sig1 = 0;
sig2 = 0;
@@ -1686,8 +1688,14 @@
head_ptr->pid, testing, waiting, mclients, zombie_check);

/* moved condition from interrupt handler to here */
- if ((sig1 > 0) || (sig2 > 0))
- check_signal_flags;
+ /* if ((sig1 > 0) || (sig2 > 0))
+ * check_signal_flags;
+ */
+
+ if (sig13 == 1) {
+ log_println(5, "todo: Handle SIGPIPE signal, terminate child?");
+ sig13 = 0;
+ }

if (sig17 > 0) {
log_println(5, "Handle pending SIGCHLD signal, count=%d", sig17);
@@ -1695,7 +1703,7 @@
}

if ((waiting < 0) || (mclients < 0)) {
- log_println(6, "Fault: Negtive numver of clents waiting=$d, mclients=%d, nuke them", waiting, mclients);
+ log_println(6, "Fault: Negtive number of clents waiting=$d, mclients=%d, nuke them", waiting, mclients);
while (head_ptr != NULL) {
tpid = head_ptr->pid;
child_sig(-1);
@@ -1869,6 +1877,9 @@
}

/* the specially crafted data that kicks off the old clients */
+/* handle interrupt's to ensure that string is actually written
+ * RAC 3/1/10
+ */
write(ctlsockfd, "123456 654321", 13);
new_child = (struct ndtchild *) malloc(sizeof(struct ndtchild));
memset(new_child, 0, sizeof(struct ndtchild));
@@ -1893,6 +1904,7 @@
switch (chld_pid) {
case -1: /* an error occured, log it and quit */
log_println(0, "fork() failed, errno = %d", errno);
+ /* todo: handle error and continue */
break;
default: /* this is the parent process, handle scheduling and
* queuing of multiple incoming clients
@@ -2112,6 +2124,11 @@
mclients++;
sprintf(tmpstr, "go %d %s", t_opts, test_suite);
send_msg(mchild->ctlsockfd, SRV_QUEUE, "0", 1);
+/* the write() call could return before any data is written if a interrupt is processed
+ * change code to detect this condition and redo the write() if it exits prematurely.
+ * fix here, below, and above where we write the 123456 string.
+ * RAC 3/18/10
+ */
write(mchild->pipe, tmpstr, strlen(tmpstr));
close(mchild->pipe);
close(mchild->ctlsockfd);
@@ -2147,6 +2164,10 @@
*/
for (;;) {
memset(buff, 0, sizeof(buff));
+/* the read() could return if an interrupt was caught. This condition
+ * should be checked for and the read() restarted if necessary
+ * RAC 3/18/10
+ */
read(chld_pipe[0], buff, 32);
if (strncmp(buff, "go", 2) == 0) {
log_println(6, "Got 'go' signal from parent, ready to start testing");
=======================================
--- /trunk/src/web100srv.h Sun Feb 28 11:29:32 2010
+++ /trunk/src/web100srv.h Sun Mar 21 11:04:42 2010
@@ -220,6 +220,7 @@
/* global variables for signal processing */
sig_atomic_t sig1;
sig_atomic_t sig2;
+sig_atomic_t sig13;
sig_atomic_t sig17;
pid_t sig17_pid[256];



  • [ndt] r317 committed - Updates to server code..., ndt, 03/21/2010

Archive powered by MHonArc 2.6.16.

Top of Page