From bdb1e964d343f776382dcf498809f556692e52a6 Mon Sep 17 00:00:00 2001 From: Peter Seebach Date: Thu, 20 Aug 2015 17:40:47 -0500 Subject: Reduce unused message sending OP_OPEN and OP_EXEC are used only when logging. The server can now tell the client (in response to initial ping) whether or not it is logging, and if it isn't, the client doesn't send those messages. Signed-off-by: Peter Seebach --- ChangeLog.txt | 3 +++ pseudo.c | 6 +++++- pseudo_client.c | 14 +++++++++++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/ChangeLog.txt b/ChangeLog.txt index 1ac657c..3a9b9e2 100644 --- a/ChangeLog.txt +++ b/ChangeLog.txt @@ -1,3 +1,6 @@ +2015-08-20: + * (seebs) don't send open/exec messages unless server is logging. + 2015-08-19: * (seebs) Reduce alloc/free cycles in path computations. diff --git a/pseudo.c b/pseudo.c index 3912fef..26772e6 100644 --- a/pseudo.c +++ b/pseudo.c @@ -1069,7 +1069,11 @@ int pseudo_server_response(pseudo_msg_t *msg, const char *program, const char *tag, char **response_path, size_t *response_len) { switch (msg->type) { case PSEUDO_MSG_PING: - msg->result = RESULT_SUCCEED; + /* mad hackery: if we aren't logging, the client gets told + * not to send open/exec notifications, which have no other + * purpose. + */ + msg->result = opt_l ? RESULT_SUCCEED : RESULT_FAIL; if (opt_l) pdb_log_msg(SEVERITY_INFO, msg, program, tag, NULL); return 0; diff --git a/pseudo_client.c b/pseudo_client.c index bb9e1e8..2f7fe7d 100644 --- a/pseudo_client.c +++ b/pseudo_client.c @@ -74,6 +74,7 @@ char *pseudo_cwd_rel = NULL; int pseudo_disabled = 0; int pseudo_allow_fsync = 0; static int pseudo_local_only = 0; +static int pseudo_client_logging = 1; int pseudo_umask = 022; @@ -1065,7 +1066,14 @@ client_ping(void) { /* and that's not good, so... */ server_pid = 0; return 1; - } + } else { + /* The server tells us whether or not to log things. */ + if (ack->result == RESULT_SUCCEED) { + pseudo_client_logging = 1; + } else { + pseudo_client_logging = 0; + } + } pseudo_debug(PDBGF_CLIENT | PDBGF_VERBOSE, "ping ok\n"); return 0; } @@ -1645,7 +1653,8 @@ pseudo_client_op(pseudo_op_t op, int access, int fd, int dirfd, const char *path break; case OP_OPEN: pseudo_client_path(fd, path); - do_request = 1; + case OP_EXEC: /* fallthrough */ + do_request = pseudo_client_logging; break; case OP_CLOSE: /* no request needed */ @@ -1701,7 +1710,6 @@ pseudo_client_op(pseudo_op_t op, int access, int fd, int dirfd, const char *path * (operations which can create should be CREAT or MKNOD * or MKDIR) */ - case OP_EXEC: case OP_CHOWN: case OP_FCHOWN: case OP_FSTAT: -- cgit v1.2.2-1-g5e49