aboutsummaryrefslogtreecommitdiffstats
path: root/pseudo_client.c
diff options
context:
space:
mode:
Diffstat (limited to 'pseudo_client.c')
-rw-r--r--pseudo_client.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/pseudo_client.c b/pseudo_client.c
index b1a00fa..2a4c106 100644
--- a/pseudo_client.c
+++ b/pseudo_client.c
@@ -1357,7 +1357,7 @@ pseudo_client_request(pseudo_msg_t *msg, size_t len, const char *path) {
}
int
-pseudo_client_shutdown(void) {
+pseudo_client_shutdown(int wait_on_socket) {
pseudo_msg_t msg;
pseudo_msg_t *ack;
char *pseudo_path;
@@ -1428,12 +1428,17 @@ pseudo_client_shutdown(void) {
pseudo_diag("server did not respond to shutdown query.\n");
return 1;
}
- if (ack->type == PSEUDO_MSG_ACK) {
- return 0;
+ if (ack->type != PSEUDO_MSG_ACK) {
+ pseudo_diag("Server refused shutdown. Remaining client fds: %d\n", ack->fd);
+ pseudo_diag("Client pids: %s\n", ack->path);
+ pseudo_diag("Server will shut down after all clients exit.\n");
+ }
+ if (wait_on_socket) {
+ /* try to receive a message the server won't send;
+ * this should abort/error-out when the server actually
+ * shuts down. */
+ ack = pseudo_msg_receive(connect_fd);
}
- pseudo_diag("Server refused shutdown. Remaining client fds: %d\n", ack->fd);
- pseudo_diag("Client pids: %s\n", ack->path);
- pseudo_diag("Server will shut down after all clients exit.\n");
return 0;
}