Skip to Content.
Sympa Menu

ndt-dev - [ndt-dev] [ndt] r956 committed - Merged Issue122 branch to resolve Issue 122.

Subject: NDT-DEV email list created

List archive

[ndt-dev] [ndt] r956 committed - Merged Issue122 branch to resolve Issue 122.


Chronological Thread 
  • From:
  • To:
  • Subject: [ndt-dev] [ndt] r956 committed - Merged Issue122 branch to resolve Issue 122.
  • Date: Fri, 21 Feb 2014 16:32:22 +0000

Revision: 956
Author:

Date: Fri Feb 21 16:32:03 2014 UTC
Log: Merged Issue122 branch to resolve Issue 122.
http://code.google.com/p/ndt/source/detail?r=956

Modified:
/trunk
/trunk/src/protocol.h
/trunk/src/testoptions.c
/trunk/src/web100srv.c

=======================================
--- /trunk/src/protocol.h Thu Feb 20 20:20:35 2014 UTC
+++ /trunk/src/protocol.h Fri Feb 21 16:32:03 2014 UTC
@@ -25,10 +25,19 @@
#define MSG_WAITING 10

#define SRV_QUEUE_TEST_STARTS_NOW 0
+#define SRV_QUEUE_TEST_STARTS_NOW_STR "0"
+
#define SRV_QUEUE_SERVER_FAULT 9977
+#define SRV_QUEUE_SERVER_FAULT_STR "9977"
+
#define SRV_QUEUE_SERVER_BUSY 9988
+#define SRV_QUEUE_SERVER_BUSY_STR "9988"
+
#define SRV_QUEUE_HEARTBEAT 9990
+#define SRV_QUEUE_HEARTBEAT_STR "9990"
+
#define SRV_QUEUE_SERVER_BUSY_60s 9999
+#define SRV_QUEUE_SERVER_BUSY_60s_STR "9999"

/*
#define TEST_NONE 0
=======================================
--- /trunk/src/testoptions.c Thu Feb 20 20:20:35 2014 UTC
+++ /trunk/src/testoptions.c Fri Feb 21 16:32:03 2014 UTC
@@ -210,6 +210,10 @@
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();

@@ -218,8 +222,8 @@

// read the test suite request
if (recv_msg(ctlsockfd, &msgType, &useropt, &msgLen)) {
- snprintf(buff, buff_strlen, "Invalid test suite request");
- send_msg(ctlsockfd, MSG_ERROR, buff, strlen(buff));
+ send_msg(ctlsockfd, MSG_ERROR, invalid_test_suite,
+ strlen(invalid_test_suite));
return (-1);
}
if (msgLen == -1) {
@@ -228,8 +232,7 @@
}
// Expecting a MSG_LOGIN with payload byte indicating tests to be run
if ((msgType != MSG_LOGIN) || (msgLen != 1)) {
- snprintf(buff, buff_strlen, "Invalid test request");
- send_msg(ctlsockfd, MSG_ERROR, buff, strlen(buff));
+ send_msg(ctlsockfd, MSG_ERROR, invalid_test, strlen(invalid_test));
return (-2);
}
// client connect received correctly. Logging activity
@@ -244,8 +247,8 @@
& (TEST_MID | TEST_C2S | TEST_S2C | TEST_SFW | TEST_STATUS
| TEST_META))) {
// message received does not indicate a valid test!
- snprintf(buff, buff_strlen, "Invalid test suite request");
- send_msg(ctlsockfd, MSG_ERROR, buff, strlen(buff));
+ send_msg(ctlsockfd, MSG_ERROR, invalid_test_suite,
+ strlen(invalid_test_suite));
return (-3);
}
// construct test suite request based on user options received
=======================================
--- /trunk/src/web100srv.c Thu Feb 20 20:20:35 2014 UTC
+++ /trunk/src/web100srv.c Fri Feb 21 16:32:03 2014 UTC
@@ -748,7 +748,7 @@
int i = 0, retcode;
struct timeval sel_tv;
fd_set rfd;
- char tmpstr[8], buff[32];
+ char buff[32];
int msgType, msgLen = 1;

tmp_ptr = (struct ndtchild *) head_ptr;
@@ -763,7 +763,6 @@
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) {
@@ -779,8 +778,9 @@
tmp_ptr->pid);

// send "keep-alive" SRV_QUEUE message to client and expect a response
- retcode = send_msg(tmp_ptr->ctlsockfd, SRV_QUEUE, tmpstr,
- strlen(tmpstr));
+ retcode = send_msg(tmp_ptr->ctlsockfd, SRV_QUEUE,
+ SRV_QUEUE_HEARTBEAT_STR,
+ strlen(SRV_QUEUE_HEARTBEAT_STR));
log_println(6,
"send_msg() returned %d during zombie check on client %d",
retcode, tmp_ptr->pid);
@@ -2018,7 +2018,9 @@
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, "9988", 4);
+ send_msg(head_ptr->ctlsockfd, SRV_QUEUE,
+ SRV_QUEUE_SERVER_BUSY_STR,
+ strlen(SRV_QUEUE_SERVER_BUSY_STR));
shutdown(head_ptr->ctlsockfd, SHUT_WR);
close(head_ptr->ctlsockfd);
tpid = head_ptr->pid;
@@ -2037,7 +2039,9 @@
"clients", head_ptr->pid);
while (head_ptr != NULL) {
/* send_msg(head_ptr->ctlsockfd, SRV_QUEUE, "9977", 4); */
- send_msg(head_ptr->ctlsockfd, SRV_QUEUE, "9988", 4);
+ send_msg(head_ptr->ctlsockfd, SRV_QUEUE,
+ SRV_QUEUE_SERVER_BUSY_STR,
+ strlen(SRV_QUEUE_SERVER_BUSY_STR));
shutdown(head_ptr->ctlsockfd, SHUT_WR);
close(head_ptr->ctlsockfd);
tpid = head_ptr->pid;
@@ -2071,7 +2075,9 @@
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, "9988", 4);
+ send_msg(head_ptr->ctlsockfd, SRV_QUEUE,
+ SRV_QUEUE_SERVER_BUSY_STR,
+ strlen(SRV_QUEUE_SERVER_BUSY_STR));
shutdown(head_ptr->ctlsockfd, SHUT_WR);
close(head_ptr->ctlsockfd);
tpid = head_ptr->pid;
@@ -2278,9 +2284,9 @@
0,
"Too many clients/mclients (%d) waiting to be served, "
"Please try again later.", chld_pid);
- // 9988 = server_BUSY_OR_ERROR
- snprintf(tmpstr, sizeof(tmpstr), "9988");
- send_msg(ctlsockfd, SRV_QUEUE, tmpstr, strlen(tmpstr));
+ send_msg(ctlsockfd, SRV_QUEUE,
+ SRV_QUEUE_SERVER_BUSY_STR,
+ strlen(SRV_QUEUE_SERVER_BUSY_STR));
close(chld_pipe[0]);
close(chld_pipe[1]);
shutdown(ctlsockfd, SHUT_WR);
@@ -2297,18 +2303,16 @@
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 string '%s' received, terminate child",
- test_suite);
+ log_println(3, "Invalid test suite received, terminate child");
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, "invalid test suite, freeing new_child=0x%x",
- new_child);
+ log_println(6, "Freeing new_child=0x%x because of "
+ "invalid test suite",
+ new_child);
free(new_child);
}
continue;
@@ -2342,7 +2346,7 @@
else
new_child->oldclient = 0;
memset(new_child->tests, 0, sizeof(test_suite));
- memcpy(new_child->tests, test_suite, strlen(test_suite));
+ memcpy(new_child->tests, test_suite, sizeof(test_suite));
new_child->next = NULL;
/* sigprocmask(SIG_SETMASK, &oldmask, NULL); */
sem_post(&ndtq);
@@ -2363,7 +2367,9 @@
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, "9988", 4);
+ send_msg(new_child->ctlsockfd, SRV_QUEUE,
+ SRV_QUEUE_SERVER_BUSY_STR,
+ strlen(SRV_QUEUE_SERVER_BUSY_STR));
close(chld_pipe[1]);
shutdown(new_child->ctlsockfd, SHUT_WR);
close(new_child->ctlsockfd);


  • [ndt-dev] [ndt] r956 committed - Merged Issue122 branch to resolve Issue 122., ndt, 02/21/2014

Archive powered by MHonArc 2.6.16.

Top of Page