projects
/
m6w6
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Set C linkage for the function pointers
[m6w6/libmemcached]
/
libmemcached
/
protocol
/
ascii_handler.c
diff --git
a/libmemcached/protocol/ascii_handler.c
b/libmemcached/protocol/ascii_handler.c
index 19aff1156d3c56698242627239714536a3eb0589..c2fd6870d6929a2cc7b1b7c9fa25fcf7b3ceb771 100644
(file)
--- a/
libmemcached/protocol/ascii_handler.c
+++ b/
libmemcached/protocol/ascii_handler.c
@@
-80,6
+80,7
@@
static void send_command_usage(memcached_protocol_client_st *client)
[UNKNOWN_CMD]= "CLIENT_ERROR: Unknown command\r\n",
};
[UNKNOWN_CMD]= "CLIENT_ERROR: Unknown command\r\n",
};
+ client->mute = false;
spool_string(client, errmsg[client->ascii_command]);
}
spool_string(client, errmsg[client->ascii_command]);
}
@@
-146,11
+147,11
@@
ascii_get_response_handler(const void *cookie,
if (client->ascii_command == GETS_CMD)
{
snprintf(dest, sizeof(buffer) - used, " %u %u %llu\r\n", flags,
if (client->ascii_command == GETS_CMD)
{
snprintf(dest, sizeof(buffer) - used, " %u %u %llu\r\n", flags,
-
flags
, (unsigned long long)cas);
+
bodylen
, (unsigned long long)cas);
}
else
{
}
else
{
- snprintf(dest, sizeof(buffer) - used, " %u %u\r\n", flags,
flags
);
+ snprintf(dest, sizeof(buffer) - used, " %u %u\r\n", flags,
bodylen
);
}
client->root->spool(client, buffer, strlen(buffer));
}
client->root->spool(client, buffer, strlen(buffer));
@@
-832,9
+833,10
@@
memcached_protocol_event_t memcached_ascii_protocol_process_data(memcached_proto
case REPLACE_CMD:
error= process_replace_command(client, tokens, ntokens,
ptr, &end, *length);
case REPLACE_CMD:
error= process_replace_command(client, tokens, ntokens,
ptr, &end, *length);
+ break;
case CAS_CMD:
error= process_cas_command(client, tokens, ntokens, ptr, &end, *length);
case CAS_CMD:
error= process_cas_command(client, tokens, ntokens, ptr, &end, *length);
- break;
+
break;
case APPEND_CMD:
error= process_append_command(client, tokens, ntokens,
ptr, &end, *length);
case APPEND_CMD:
error= process_append_command(client, tokens, ntokens,
ptr, &end, *length);
@@
-852,18
+854,34
@@
memcached_protocol_event_t memcached_ascii_protocol_process_data(memcached_proto
process_arithmetic(client, tokens, ntokens);
break;
case STATS_CMD:
process_arithmetic(client, tokens, ntokens);
break;
case STATS_CMD:
- recover_tokenize_command(ptr, end);
- process_stats(client, ptr + 6, end);
+ if (client->mute)
+ {
+ send_command_usage(client);
+ }
+ else
+ {
+ recover_tokenize_command(ptr, end);
+ process_stats(client, ptr + 6, end);
+ }
break;
case FLUSH_ALL_CMD:
process_flush(client, tokens, ntokens);
break;
case VERSION_CMD:
break;
case FLUSH_ALL_CMD:
process_flush(client, tokens, ntokens);
break;
case VERSION_CMD:
- process_version(client, tokens, ntokens);
+ if (client->mute)
+ {
+ send_command_usage(client);
+ }
+ else
+ {
+ process_version(client, tokens, ntokens);
+ }
break;
case QUIT_CMD:
break;
case QUIT_CMD:
- if (ntokens != 1)
+ if (ntokens != 1 || client->mute)
+ {
send_command_usage(client);
send_command_usage(client);
+ }
else
{
if (client->root->callback->interface.v1.quit != NULL)
else
{
if (client->root->callback->interface.v1.quit != NULL)