ndt-dev - [ndt-dev] [ndt] r947 committed - Correct for BAD previous merge.
Subject: NDT-DEV email list created
List archive
- From:
- To:
- Subject: [ndt-dev] [ndt] r947 committed - Correct for BAD previous merge.
- Date: Thu, 20 Feb 2014 20:20:53 +0000
Revision: 947
Author:
Date: Thu Feb 20 20:20:35 2014 UTC
Log: Correct for BAD previous merge.
http://code.google.com/p/ndt/source/detail?r=947
Modified:
/trunk/src/protocol.h
/trunk/src/testoptions.c
/trunk/src/web100srv.c
=======================================
--- /trunk/src/protocol.h Thu Feb 20 20:08:46 2014 UTC
+++ /trunk/src/protocol.h Thu Feb 20 20:20:35 2014 UTC
@@ -25,24 +25,10 @@
#define MSG_WAITING 10
#define SRV_QUEUE_TEST_STARTS_NOW 0
-#define SRV_QUEUE_TEST_STARTS_NOW_STR "0"
-#define SRV_QUEUE_TEST_STARTS_NOW_STR_LN 4
-
#define SRV_QUEUE_SERVER_FAULT 9977
-#define SRV_QUEUE_SERVER_FAULT_STR "9977"
-#define SRV_QUEUE_SERVER_FAULT_STR_LN 4
-
#define SRV_QUEUE_SERVER_BUSY 9988
-#define SRV_QUEUE_SERVER_BUSY_STR "9988"
-#define SRV_QUEUE_SERVER_BUSY_STR_LN 4
-
#define SRV_QUEUE_HEARTBEAT 9990
-#define SRV_QUEUE_HEARTBEAT_STR "9990"
-#define SRV_QUEUE_HEARTBEAT_STR_LN 4
-
#define SRV_QUEUE_SERVER_BUSY_60s 9999
-#define SRV_QUEUE_SERVER_BUSY_60s_STR "9999"
-#define SRV_QUEUE_SERVER_BUSY_60s_STR_LN 4
/*
#define TEST_NONE 0
=======================================
--- /trunk/src/testoptions.c Thu Feb 20 20:08:46 2014 UTC
+++ /trunk/src/testoptions.c Thu Feb 20 20:20:35 2014 UTC
@@ -210,10 +210,6 @@
int msgType;
int msgLen = 1;
int first = 1;
- char *invalid_test_suite = "Invalid test suite request.";
- char *client_timeout = "Client timeout.";
- char *invalid_test = "Invalid test request.";
-
// char remhostarr[256], protologlocalarr[256];
// char *remhost_ptr = get_remotehost();
@@ -222,8 +218,8 @@
// read the test suite request
if (recv_msg(ctlsockfd, &msgType, &useropt, &msgLen)) {
- send_msg(ctlsockfd, MSG_ERROR, invalid_test_suite,
- strlen(invalid_test_suite));
+ snprintf(buff, buff_strlen, "Invalid test suite request");
+ send_msg(ctlsockfd, MSG_ERROR, buff, strlen(buff));
return (-1);
}
if (msgLen == -1) {
@@ -232,7 +228,8 @@
}
// Expecting a MSG_LOGIN with payload byte indicating tests to be run
if ((msgType != MSG_LOGIN) || (msgLen != 1)) {
- send_msg(ctlsockfd, MSG_ERROR, invalid_test, strlen(invalid_test));
+ snprintf(buff, buff_strlen, "Invalid test request");
+ send_msg(ctlsockfd, MSG_ERROR, buff, strlen(buff));
return (-2);
}
// client connect received correctly. Logging activity
@@ -247,8 +244,8 @@
& (TEST_MID | TEST_C2S | TEST_S2C | TEST_SFW | TEST_STATUS
| TEST_META))) {
// message received does not indicate a valid test!
- send_msg(ctlsockfd, MSG_ERROR, invalid_test_suite,
- strlen(invalid_test_suite));
+ snprintf(buff, buff_strlen, "Invalid test suite request");
+ send_msg(ctlsockfd, MSG_ERROR, buff, strlen(buff));
return (-3);
}
// construct test suite request based on user options received
=======================================
--- /trunk/src/web100srv.c Thu Feb 20 20:08:46 2014 UTC
+++ /trunk/src/web100srv.c Thu Feb 20 20:20:35 2014 UTC
@@ -748,7 +748,7 @@
int i = 0, retcode;
struct timeval sel_tv;
fd_set rfd;
- char buff[32];
+ char tmpstr[8], buff[32];
int msgType, msgLen = 1;
tmp_ptr = (struct ndtchild *) head_ptr;
@@ -763,6 +763,7 @@
pre_ptr = tmp_ptr;
tmp_ptr = tmp_ptr->next;
}
+ snprintf(tmpstr, sizeof(tmpstr), "9990");
i = 0;
while (tmp_ptr != NULL) {
if (tmp_ptr->oldclient == 0) {
@@ -778,9 +779,8 @@
tmp_ptr->pid);
// send "keep-alive" SRV_QUEUE message to client and expect a response
- retcode = send_msg(tmp_ptr->ctlsockfd, SRV_QUEUE,
- SRV_QUEUE_HEARTBEAT_STR,
- SRV_QUEUE_HEARTBEAT_STR_LN);
+ retcode = send_msg(tmp_ptr->ctlsockfd, SRV_QUEUE, tmpstr,
+ strlen(tmpstr));
log_println(6,
"send_msg() returned %d during zombie check on client %d",
retcode, tmp_ptr->pid);
@@ -2018,9 +2018,7 @@
while (head_ptr != NULL) {
/* send_msg(head_ptr->ctlsockfd, SRV_QUEUE, "9933", 4); */
// indicate server waiting in queue
- send_msg(head_ptr->ctlsockfd, SRV_QUEUE,
- SRV_QUEUE_SERVER_BUSY_STR,
- SRV_QUEUE_SERVER_BUSY_STR_LN);
+ send_msg(head_ptr->ctlsockfd, SRV_QUEUE, "9988", 4);
shutdown(head_ptr->ctlsockfd, SHUT_WR);
close(head_ptr->ctlsockfd);
tpid = head_ptr->pid;
@@ -2039,9 +2037,7 @@
"clients", head_ptr->pid);
while (head_ptr != NULL) {
/* send_msg(head_ptr->ctlsockfd, SRV_QUEUE, "9977", 4); */
- send_msg(head_ptr->ctlsockfd, SRV_QUEUE,
- SRV_QUEUE_SERVER_BUSY_STR,
- SRV_QUEUE_SERVER_BUSY_STR_LN);
+ send_msg(head_ptr->ctlsockfd, SRV_QUEUE, "9988", 4);
shutdown(head_ptr->ctlsockfd, SHUT_WR);
close(head_ptr->ctlsockfd);
tpid = head_ptr->pid;
@@ -2075,9 +2071,7 @@
head_ptr->pipe, head_ptr->running, head_ptr->ctlsockfd,
head_ptr->oldclient, head_ptr->tests);
// boot the client
- send_msg(head_ptr->ctlsockfd, SRV_QUEUE,
- SRV_QUEUE_SERVER_BUSY_STR,
- SRV_QUEUE_SERVER_BUSY_STR_LN);
+ send_msg(head_ptr->ctlsockfd, SRV_QUEUE, "9988", 4);
shutdown(head_ptr->ctlsockfd, SHUT_WR);
close(head_ptr->ctlsockfd);
tpid = head_ptr->pid;
@@ -2284,9 +2278,9 @@
0,
"Too many clients/mclients (%d) waiting to be served, "
"Please try again later.", chld_pid);
- send_msg(ctlsockfd, SRV_QUEUE,
- SRV_QUEUE_SERVER_BUSY_STR,
- SRV_QUEUE_SERVER_BUSY_STR_LN);
+ // 9988 = server_BUSY_OR_ERROR
+ snprintf(tmpstr, sizeof(tmpstr), "9988");
+ send_msg(ctlsockfd, SRV_QUEUE, tmpstr, strlen(tmpstr));
close(chld_pipe[0]);
close(chld_pipe[1]);
shutdown(ctlsockfd, SHUT_WR);
@@ -2303,16 +2297,18 @@
t_opts = initialize_tests(ctlsockfd, &testopt, test_suite,
sizeof(test_suite));
if (t_opts < 1) { // some error in initialization routines
- log_println(3, "Invalid test suite received, terminate child");
+ log_println(
+ 3,
+ "Invalid test suite string '%s' received, terminate child",
+ test_suite);
close(chld_pipe[0]);
close(chld_pipe[1]);
shutdown(ctlsockfd, SHUT_WR);
close(ctlsockfd);
kill(chld_pid, SIGTERM);
if (new_child != NULL) {
- log_println(6, "Freeing new_child=0x%x because of "
- "invalid test suite",
- new_child);
+ log_println(6, "invalid test suite, freeing new_child=0x%x",
+ new_child);
free(new_child);
}
continue;
@@ -2346,7 +2342,7 @@
else
new_child->oldclient = 0;
memset(new_child->tests, 0, sizeof(test_suite));
- memcpy(new_child->tests, test_suite, sizeof(test_suite));
+ memcpy(new_child->tests, test_suite, strlen(test_suite));
new_child->next = NULL;
/* sigprocmask(SIG_SETMASK, &oldmask, NULL); */
sem_post(&ndtq);
@@ -2367,9 +2363,7 @@
3,
"queuing disabled and testing in progress, tell client no");
/* send_msg(new_child->ctlsockfd, SRV_QUEUE, "9944", 4); */
- send_msg(new_child->ctlsockfd, SRV_QUEUE,
- SRV_QUEUE_SERVER_BUSY_STR,
- SRV_QUEUE_SERVER_BUSY_STR_LN);
+ send_msg(new_child->ctlsockfd, SRV_QUEUE, "9988", 4);
close(chld_pipe[1]);
shutdown(new_child->ctlsockfd, SHUT_WR);
close(new_child->ctlsockfd);
- [ndt-dev] [ndt] r947 committed - Correct for BAD previous merge., ndt, 02/20/2014
Archive powered by MHonArc 2.6.16.