projects
/
m6w6
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
add test for longer data, 8K
[m6w6/libmemcached]
/
lib
/
memcached_stats.c
diff --git
a/lib/memcached_stats.c
b/lib/memcached_stats.c
index 2511532c26f7db2754cf1081ebc221980acb0517..867147591c195116773d2a62ce752232846d0919 100644
(file)
--- a/
lib/memcached_stats.c
+++ b/
lib/memcached_stats.c
@@
-122,7
+122,7
@@
static memcached_return memcached_stats_fetch(memcached_st *ptr,
{
memcached_return rc;
char buffer[HUGE_STRING_LEN];
{
memcached_return rc;
char buffer[HUGE_STRING_LEN];
- size_t send_length;
+ size_t send_length
, sent_length
;
rc= memcached_connect(ptr);
rc= memcached_connect(ptr);
@@
-136,10
+136,21
@@
static memcached_return memcached_stats_fetch(memcached_st *ptr,
send_length= snprintf(buffer, HUGE_STRING_LEN,
"stats\r\n");
send_length= snprintf(buffer, HUGE_STRING_LEN,
"stats\r\n");
- if ((send(ptr->hosts[server_key].fd, buffer, send_length, 0) == -1))
+ if (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE)
+ return MEMCACHED_WRITE_FAILURE;
+
+ sent_length= write(ptr->hosts[server_key].fd, buffer, send_length);
+
+ if (sent_length == -1)
{
{
- fprintf(stderr, "failed on stats\n");
+ fprintf(stderr, "error %s: write: %m\n", __FUNCTION__);
+ return MEMCACHED_WRITE_FAILURE;
+ }
+ if (sent_length != send_length)
+ {
+ fprintf(stderr, "error %s: short write %d %d: %m\n",
+ __FUNCTION__, sent_length, send_length);
return MEMCACHED_WRITE_FAILURE;
}
return MEMCACHED_WRITE_FAILURE;
}
@@
-207,9
+218,7
@@
memcached_stat_st *memcached_stat(memcached_st *ptr, char *args, memcached_retur
memcached_return memcached_stat_hostname(memcached_stat_st *stat, char *args,
char *hostname, unsigned int port)
{
memcached_return memcached_stat_hostname(memcached_stat_st *stat, char *args,
char *hostname, unsigned int port)
{
- size_t send_length;
memcached_return rc;
memcached_return rc;
- char buffer[HUGE_STRING_LEN];
memcached_st memc;
memcached_init(&memc);
memcached_st memc;
memcached_init(&memc);