char buffer[SMALL_STRING_LEN];
*error= MEMCACHED_SUCCESS;
-
- memset(buffer, 0, SMALL_STRING_LEN);
-
if (!memcmp("pid", key, strlen("pid")))
snprintf(buffer, SMALL_STRING_LEN,"%u", stat->pid);
else if (!memcmp("uptime", key, strlen("uptime")))
{
memcached_return rc;
char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE];
- size_t send_length, sent_length;
+ size_t send_length;
- rc= memcached_connect(ptr);
+ rc= memcached_connect(ptr, server_key);
if (rc != MEMCACHED_SUCCESS)
return rc;
if (send_length >= MEMCACHED_DEFAULT_COMMAND_SIZE)
return MEMCACHED_WRITE_FAILURE;
- sent_length= memcached_io_write(ptr, server_key, buffer, send_length, 1);
-
- if (sent_length == -1 || sent_length != send_length)
- return MEMCACHED_WRITE_FAILURE;
+ rc= memcached_do(ptr, server_key, buffer, send_length, 1);
+ if (rc != MEMCACHED_SUCCESS)
+ goto error;
while (1)
{
- rc= memcached_response(ptr, buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, 0);
+ rc= memcached_response(ptr, buffer, MEMCACHED_DEFAULT_COMMAND_SIZE, server_key);
if (rc == MEMCACHED_STAT)
{
break;
}
+error:
if (rc == MEMCACHED_END)
return MEMCACHED_SUCCESS;
else
memcached_return rc;
memcached_stat_st *stats;
- rc= memcached_connect(ptr);
- if (rc != MEMCACHED_SUCCESS)
- {
- *error= rc;
- return NULL;
- }
-
stats= (memcached_stat_st *)malloc(sizeof(memcached_st)*(ptr->number_of_hosts+1));
if (!stats)
{
}
memset(stats, 0, sizeof(memcached_st)*(ptr->number_of_hosts+1));
+ rc= MEMCACHED_SUCCESS;
for (x= 0; x < ptr->number_of_hosts; x++)
{
- rc= memcached_stats_fetch(ptr, stats+x, args, x);
- if (rc != MEMCACHED_SUCCESS)
+ memcached_return temp_return;
+ temp_return= memcached_stats_fetch(ptr, stats+x, args, x);
+ if (temp_return != MEMCACHED_SUCCESS)
rc= MEMCACHED_SOME_ERRORS;
}
memcached_server_add(&memc, hostname, port);
- rc= memcached_connect(&memc);
-
- if (rc != MEMCACHED_SUCCESS)
- return rc;
-
rc= memcached_stats_fetch(&memc, stat, args, 0);
memcached_free(&memc);
return list;
}
+
+void memcached_stat_free(memcached_st *ptr, memcached_stat_st *stat)
+{
+ free(stat);
+}