aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Seebach <peter.seebach@windriver.com>2016-02-05 10:11:57 -0600
committerPeter Seebach <peter.seebach@windriver.com>2016-02-05 10:11:57 -0600
commit2045939c076a48a48252aeb92280ebd8739b18de (patch)
tree2bc158f23110a1806b25846e1af7b5853461c092
parent9e78667ea604fc0a8e538973973b48ae0741a8b2 (diff)
downloadpseudo-2045939c076a48a48252aeb92280ebd8739b18de.tar.gz
pseudo-2045939c076a48a48252aeb92280ebd8739b18de.tar.bz2
pseudo-2045939c076a48a48252aeb92280ebd8739b18de.zip
pseudo_server.c: new clients cancel a shutdown request
If a SHUTDOWN message has caused us to set the "die_peacefully" flag, but there are new clients waiting, cancel the shutdown.
-rw-r--r--ChangeLog.txt1
-rw-r--r--pseudo_server.c7
2 files changed, 7 insertions, 1 deletions
diff --git a/ChangeLog.txt b/ChangeLog.txt
index 7c55464..919b928 100644
--- a/ChangeLog.txt
+++ b/ChangeLog.txt
@@ -1,5 +1,6 @@
2016-02-05:
* (seebs) don't abort search for server on first try.
+ * (seebs) new clients cancel a shutdown request.
2016-01-22:
* (seebs) Mask in S_IFREG when mknod called with no S_IFMT bits.
diff --git a/pseudo_server.c b/pseudo_server.c
index 1fdadcb..56fbbc4 100644
--- a/pseudo_server.c
+++ b/pseudo_server.c
@@ -474,7 +474,7 @@ pseudo_server_loop(void) {
if (die_forcefully)
break;
}
- if (!(die_peacefully || die_forcefully) &&
+ if (!die_forcefully &&
(FD_ISSET(clients[0].fd, &events) ||
FD_ISSET(clients[0].fd, &reads))) {
len = sizeof(client);
@@ -482,6 +482,11 @@ pseudo_server_loop(void) {
pseudo_debug(PDBGF_SERVER, "new client fd %d\n", fd);
open_client(fd);
}
+ /* A new client implicitly cancels a previous
+ * shutdown request.
+ */
+ pseudo_server_timeout = 30;
+ die_peacefully = 0;
}
pseudo_debug(PDBGF_SERVER, "server loop complete [%d clients left]\n", active_clients);
}