From 0cdfe4724c29bade9c77186af667f84e57fb5226 Mon Sep 17 00:00:00 2001
From: Danny Auble <da@llnl.gov>
Date: Tue, 17 Oct 2006 19:31:40 +0000
Subject: [PATCH] timeout logic now working in 1.2

---
 src/common/slurm_protocol_api.c | 28 ++++++++++++++++++----------
 src/slurmd/slurmd/slurmd.c      |  3 +--
 2 files changed, 19 insertions(+), 12 deletions(-)

diff --git a/src/common/slurm_protocol_api.c b/src/common/slurm_protocol_api.c
index b67819f9de8..e4197b97798 100644
--- a/src/common/slurm_protocol_api.c
+++ b/src/common/slurm_protocol_api.c
@@ -789,12 +789,14 @@ int slurm_receive_msg(slurm_fd fd, slurm_msg_t *msg, int timeout)
                 timeout  = slurm_get_msg_timeout() * 1000; 
 
 	if(timeout >= (slurm_get_msg_timeout() * 10000)) {
-		error("You are sending a message with timeout's greater "
+		error("slurm_receive_msg: "
+		      "You are sending a message with timeout's greater "
 		      "than %d seconds, your's is %d seconds", 
 		      (slurm_get_msg_timeout() * 10), 
 		      (timeout/1000));
 	} else if(timeout < 1000) {
-		debug("You are sending a message with a very short timeout of "
+		debug("slurm_receive_msg: "
+		      "You are sending a message with a very short timeout of "
 		      "%d milliseconds", timeout);
 	} 
 	
@@ -932,12 +934,14 @@ List slurm_receive_msgs(slurm_fd fd, int steps, int timeout)
 	debug4("orig_timeout was %d we have %d steps and a timeout of %d",
 	       orig_timeout, steps, timeout);
 	if(orig_timeout >= (slurm_get_msg_timeout() * 10000)) {
-		error("You are sending a message with timeout's greater "
+		error("slurm_receive_msgs: "
+		      "You are sending a message with timeout's greater "
 		      "than %d seconds, your's is %d seconds", 
 		      (slurm_get_msg_timeout() * 10), 
 		      (timeout/1000));
 	} else if(orig_timeout < 1000) {
-		debug("You are sending a message with a very short timeout of "
+		debug("slurm_receive_msgs: "
+		      "You are sending a message with a very short timeout of "
 		      "%d milliseconds", timeout);
 	} 
 	
@@ -1091,12 +1095,14 @@ int slurm_receive_msg_and_forward(slurm_fd fd, slurm_addr *orig_addr,
                 timeout  = slurm_get_msg_timeout() * 1000; 
 		
 	if(timeout >= (slurm_get_msg_timeout() * 10000)) {
-		error("You are sending a message with timeout's greater "
+		error("slurm_receive_msg_and_forward: "
+		      "You are sending a message with timeout's greater "
 		      "than %d seconds, your's is %d seconds", 
 		      (slurm_get_msg_timeout() * 10), 
 		      (timeout/1000));
 	} else if(timeout < 1000) {
-		debug("You are sending a message with a very short timeout of "
+		debug("slurm_receive_msg_and_forward: "
+		      "You are sending a message with a very short timeout of "
 		      "%d milliseconds", timeout);
 	} 	
 
@@ -1742,6 +1748,11 @@ _send_and_recv_msgs(slurm_fd fd, slurm_msg_t *req, int timeout)
 	List ret_list = NULL;
 	int steps = 0;
 	
+	if (!req->forward.timeout) {
+		if(!timeout)
+			timeout = slurm_get_msg_timeout() * 1000;
+		req->forward.timeout = timeout;
+	}
 	if(slurm_send_node_msg(fd, req) >= 0) {
 		if(req->forward.cnt>0) {
 			/* figure out where we are in the tree and set
@@ -1752,10 +1763,7 @@ _send_and_recv_msgs(slurm_fd fd, slurm_msg_t *req, int timeout)
 			steps = req->forward.cnt/slurm_get_tree_width();
 			timeout = (1000*steps);
 			steps++;
-			if (!req->forward.timeout)
-				req->forward.timeout = 
-					slurm_get_msg_timeout() * 1000;
-		
+			
 			timeout += (req->forward.timeout*steps);
 		}
 		ret_list = slurm_receive_msgs(fd, steps, timeout);
diff --git a/src/slurmd/slurmd/slurmd.c b/src/slurmd/slurmd/slurmd.c
index 395ca18322b..8d3d076c46c 100644
--- a/src/slurmd/slurmd/slurmd.c
+++ b/src/slurmd/slurmd/slurmd.c
@@ -373,8 +373,7 @@ _service_connection(void *arg)
 		slurm_send_rc_msg(msg, rc);
 		goto cleanup;
 	}
-	debug2("got this type of message %d with %d other responses",
-	     msg->msg_type, list_count(msg->ret_list));
+	debug2("got this type of message %d", msg->msg_type);
 	slurmd_req(msg);
 	
 cleanup:
-- 
GitLab