summaryrefslogtreecommitdiff
path: root/proto_text.c
diff options
context:
space:
mode:
authordormando <dormando@rydia.net>2020-06-10 22:56:07 -0700
committerdormando <dormando@rydia.net>2021-10-05 12:21:25 -0700
commitd22b66483bce8843110795609386edc6ebf65b69 (patch)
treeac2107f9450c857d9ed125a17aef79a4158da7f9 /proto_text.c
parent56dc81db316a0b957415e371d20c683fea9d7d2f (diff)
downloadmemcached-d22b66483bce8843110795609386edc6ebf65b69.tar.gz
proxy: initial commit.
See BUILD for compilation details. See t/startfile.lua for configuration examples. (see also https://github.com/memcached/memcached-proxylibs for extensions, config libraries, more examples) NOTE: io_uring mode is _not stable_, will crash. As of this commit it is not recommended to run the proxy in production. If you are interested please let us know, as we are actively stabilizing for production use.
Diffstat (limited to 'proto_text.c')
-rw-r--r--proto_text.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/proto_text.c b/proto_text.c
index 000ddd1..cfe5d97 100644
--- a/proto_text.c
+++ b/proto_text.c
@@ -5,6 +5,10 @@
#include "memcached.h"
#include "proto_text.h"
+// FIXME: only for process_proxy_stats()
+// - some better/different structure for stats subcommands
+// would remove this abstraction leak.
+#include "proto_proxy.h"
#include "authfile.h"
#include "storage.h"
#include "base64.h"
@@ -42,8 +46,6 @@
} \
}
-static void process_command(conn *c, char *command);
-
typedef struct token_s {
char *value;
size_t length;
@@ -481,7 +483,7 @@ int try_read_command_ascii(conn *c) {
assert(cont <= (c->rcurr + c->rbytes));
c->last_cmd_time = current_time;
- process_command(c, c->rcurr);
+ process_command_ascii(c, c->rcurr);
c->rbytes -= (cont - c->rcurr);
c->rcurr = cont;
@@ -792,6 +794,10 @@ static void process_stat(conn *c, token_t *tokens, const size_t ntokens) {
} else if (strcmp(subcommand, "extstore") == 0) {
process_extstore_stats(&append_stats, c);
#endif
+#ifdef PROXY
+ } else if (strcmp(subcommand, "proxy") == 0) {
+ process_proxy_stats(&append_stats, c);
+#endif
} else {
/* getting here means that the subcommand is either engine specific or
is invalid. query the engine and see. */
@@ -2684,7 +2690,7 @@ static void process_refresh_certs_command(conn *c, token_t *tokens, const size_t
// we can't drop out and back in again.
// Leaving this note here to spend more time on a fix when necessary, or if an
// opportunity becomes obvious.
-static void process_command(conn *c, char *command) {
+void process_command_ascii(conn *c, char *command) {
token_t tokens[MAX_TOKENS];
size_t ntokens;