"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "proto_text.c" between
memcached-1.6.8.tar.gz and memcached-1.6.9.tar.gz

About: memcached is a high-performance, distributed memory object caching system, generic in nature, but originally intended for use in speeding up dynamic web applications by alleviating database load.

proto_text.c  (memcached-1.6.8):proto_text.c  (memcached-1.6.9)
/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/* /*
* Functions for handling the text related protocols, original and meta. * Functions for handling the text related protocols, original and meta.
*/ */
#include "memcached.h" #include "memcached.h"
#include "proto_text.h" #include "proto_text.h"
#include "authfile.h" #include "authfile.h"
#include "storage.h"
#ifdef TLS #ifdef TLS
#include "tls.h" #include "tls.h"
#endif #endif
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
static void process_command(conn *c, char *command); static void process_command(conn *c, char *command);
typedef struct token_s { typedef struct token_s {
char *value; char *value;
skipping to change at line 522 skipping to change at line 523
char *p = resp->wbuf; char *p = resp->wbuf;
memcpy(p, "VALUE ", 6); memcpy(p, "VALUE ", 6);
p += 6; p += 6;
memcpy(p, ITEM_key(it), it->nkey); memcpy(p, ITEM_key(it), it->nkey);
p += it->nkey; p += it->nkey;
p += make_ascii_get_suffix(p, it, return_cas, nbytes); p += make_ascii_get_suffix(p, it, return_cas, nbytes);
resp_add_iov(resp, resp->wbuf, p - resp->wbuf); resp_add_iov(resp, resp->wbuf, p - resp->wbuf);
#ifdef EXTSTORE #ifdef EXTSTORE
if (it->it_flags & ITEM_HDR) { if (it->it_flags & ITEM_HDR) {
if (_get_extstore(c, it, resp) != 0) { if (storage_get_item(c, it, resp) != 0) {
pthread_mutex_lock(&c->thread->stats.mutex); pthread_mutex_lock(&c->thread->stats.mutex);
c->thread->stats.get_oom_extstore++; c->thread->stats.get_oom_extstore++;
pthread_mutex_unlock(&c->thread->stats.mutex); pthread_mutex_unlock(&c->thread->stats.mutex);
item_remove(it); item_remove(it);
goto stop; goto stop;
} }
} else if ((it->it_flags & ITEM_CHUNKED) == 0) { } else if ((it->it_flags & ITEM_CHUNKED) == 0) {
resp_add_iov(resp, ITEM_data(it), it->nbytes); resp_add_iov(resp, ITEM_data(it), it->nbytes);
} else { } else {
skipping to change at line 1165 skipping to change at line 1166
*p = '\r'; *p = '\r';
*(p+1) = '\n'; *(p+1) = '\n';
*(p+2) = '\0'; *(p+2) = '\0';
p += 2; p += 2;
// finally, chain in the buffer. // finally, chain in the buffer.
resp_add_iov(resp, resp->wbuf, p - resp->wbuf); resp_add_iov(resp, resp->wbuf, p - resp->wbuf);
if (of.value) { if (of.value) {
#ifdef EXTSTORE #ifdef EXTSTORE
if (it->it_flags & ITEM_HDR) { if (it->it_flags & ITEM_HDR) {
if (_get_extstore(c, it, resp) != 0) { if (storage_get_item(c, it, resp) != 0) {
pthread_mutex_lock(&c->thread->stats.mutex); pthread_mutex_lock(&c->thread->stats.mutex);
c->thread->stats.get_oom_extstore++; c->thread->stats.get_oom_extstore++;
pthread_mutex_unlock(&c->thread->stats.mutex); pthread_mutex_unlock(&c->thread->stats.mutex);
failed = true; failed = true;
} }
} else if ((it->it_flags & ITEM_CHUNKED) == 0) { } else if ((it->it_flags & ITEM_CHUNKED) == 0) {
resp_add_iov(resp, ITEM_data(it), it->nbytes); resp_add_iov(resp, ITEM_data(it), it->nbytes);
} else { } else {
resp_add_chunked_iov(resp, it, it->nbytes); resp_add_chunked_iov(resp, it, it->nbytes);
skipping to change at line 2344 skipping to change at line 2345
static void process_version_command(conn *c) { static void process_version_command(conn *c) {
out_string(c, "VERSION " VERSION); out_string(c, "VERSION " VERSION);
} }
static void process_quit_command(conn *c) { static void process_quit_command(conn *c) {
conn_set_state(c, conn_mwrite); conn_set_state(c, conn_mwrite);
c->close_after_write = true; c->close_after_write = true;
} }
static void process_shutdown_command(conn *c) { static void process_shutdown_command(conn *c, token_t *tokens, const size_t ntok
if (settings.shutdown_command) { ens) {
if (!settings.shutdown_command) {
out_string(c, "ERROR: shutdown not enabled");
return;
}
if (ntokens == 2) {
conn_set_state(c, conn_closing); conn_set_state(c, conn_closing);
raise(SIGINT); raise(SIGINT);
} else if (ntokens == 3 && strcmp(tokens[SUBCOMMAND_TOKEN].value, "graceful"
) == 0) {
conn_set_state(c, conn_closing);
raise(SIGUSR1);
} else { } else {
out_string(c, "ERROR: shutdown not enabled"); out_string(c, "CLIENT_ERROR invalid shutdown mode");
} }
} }
static void process_slabs_command(conn *c, token_t *tokens, const size_t ntokens ) { static void process_slabs_command(conn *c, token_t *tokens, const size_t ntokens ) {
if (ntokens == 5 && strcmp(tokens[COMMAND_TOKEN + 1].value, "reassign") == 0 ) { if (ntokens == 5 && strcmp(tokens[COMMAND_TOKEN + 1].value, "reassign") == 0 ) {
int src, dst, rv; int src, dst, rv;
if (settings.slab_reassign == false) { if (settings.slab_reassign == false) {
out_string(c, "CLIENT_ERROR slab reassignment disabled"); out_string(c, "CLIENT_ERROR slab reassignment disabled");
return; return;
skipping to change at line 2616 skipping to change at line 2625
} else if (first == 's') { } else if (first == 's') {
if (strcmp(tokens[COMMAND_TOKEN].value, "set") == 0 && (comm = NREAD_SET )) { if (strcmp(tokens[COMMAND_TOKEN].value, "set") == 0 && (comm = NREAD_SET )) {
WANT_TOKENS_OR(ntokens, 6, 7); WANT_TOKENS_OR(ntokens, 6, 7);
process_update_command(c, tokens, ntokens, comm, false); process_update_command(c, tokens, ntokens, comm, false);
} else if (strcmp(tokens[COMMAND_TOKEN].value, "stats") == 0) { } else if (strcmp(tokens[COMMAND_TOKEN].value, "stats") == 0) {
process_stat(c, tokens, ntokens); process_stat(c, tokens, ntokens);
} else if (strcmp(tokens[COMMAND_TOKEN].value, "shutdown") == 0) { } else if (strcmp(tokens[COMMAND_TOKEN].value, "shutdown") == 0) {
process_shutdown_command(c); process_shutdown_command(c, tokens, ntokens);
} else if (strcmp(tokens[COMMAND_TOKEN].value, "slabs") == 0) { } else if (strcmp(tokens[COMMAND_TOKEN].value, "slabs") == 0) {
process_slabs_command(c, tokens, ntokens); process_slabs_command(c, tokens, ntokens);
} else { } else {
out_string(c, "ERROR"); out_string(c, "ERROR");
} }
} else if (first == 'a') { } else if (first == 'a') {
if ((strcmp(tokens[COMMAND_TOKEN].value, "add") == 0 && (comm = NREAD_AD D)) || if ((strcmp(tokens[COMMAND_TOKEN].value, "add") == 0 && (comm = NREAD_AD D)) ||
(strcmp(tokens[COMMAND_TOKEN].value, "append") == 0 && (comm = NREAD _APPEND)) ) { (strcmp(tokens[COMMAND_TOKEN].value, "append") == 0 && (comm = NREAD _APPEND)) ) {
 End of changes. 7 change blocks. 
6 lines changed or deleted 17 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)