-0.17
- * MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT added for connect timeout in
- non-block mode.
+0.18
* Fix plus tests for non-zero value objects and flags.
* MEMCACHED_HASH_MURMUR added for murmur algorithm provided.
* MEMCACHED_BEHAVIOR_RETRY_TIMEOUT added to keep connecting from looping
on timeout.
+0.17 Wed Feb 27 03:33:29 PST 2008
+ * MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT added for connect timeout in
+ non-block mode.
+ * Incompatible change in memcached_behavior_set() api. We now use a
+ uint64_t, instead of a pointer.
+ * Fix for storage of values for zero.
+ * memcached_server_cursor() function added to API for cycling through servers.
+
0.16 Mon Feb 18 00:30:25 PST 2008
* Work on the UDP protocol
* Added get_by_key, set_by_key tests for C++ API
Kevin Dalley - Bug Fixes
Patrick Galbraith - work on C++ interface
Ross McFarland - Idea for sorting servers.
+Marcelo Fernandez - TCP/IP timeout pieces
void memcached_quit(memcached_st *ptr);
char *memcached_strerror(memcached_st *ptr, memcached_return rc);
memcached_return memcached_behavior_set(memcached_st *ptr, memcached_behavior flag, void *data);
-unsigned long long memcached_behavior_get(memcached_st *ptr, memcached_behavior flag);
+uint64_t memcached_behavior_get(memcached_st *ptr, memcached_behavior flag);
/* All of the functions for adding data to the server */
memcached_return memcached_set(memcached_st *ptr, char *key, size_t key_length,
#include "common.h"
+#include <poll.h>
static memcached_return set_hostinfo(memcached_server_st *server)
{
{
switch (errno) {
case EINPROGRESS:
- {
- struct timeval tm = { ptr->root->connect_timeout, 0 };
- socklen_t len= sizeof(int);
- fd_set wset;
- int error=0, value;
-
- FD_ZERO(&wset);
- FD_SET(ptr->fd, &wset);
-
- select(ptr->fd+1, NULL, &wset, NULL, &tm);
- if (FD_ISSET(ptr->fd, &wset) != 0)
- {
- if (getsockopt(ptr->fd, SOL_SOCKET, SO_ERROR, &value, &len) == 0)
- {
- if (value)
- {
- error= 1;
- }
- }
- else
- {
- error= 1;
- }
- }
- else
- {
- error= 1;
- }
-
- if (error)
- {
- ptr->cached_errno= errno;
- WATCHPOINT_ERRNO(ptr->cached_errno);
- close(ptr->fd);
- ptr->fd= -1;
- return MEMCACHED_ERRNO;
- }
-
- break;
- }
- /* We are spinning waiting on connect */
case EALREADY:
case EINTR:
goto test_connect;
/* We are spinning waiting on connect */
case EALREADY:
case EINPROGRESS:
+ {
+ struct pollfd fds[1];
+ int error;
+
+ memset(&fds, 0, sizeof(struct pollfd));
+ fds[0].fd= ptr->fd;
+ fds[0].events= POLLOUT | POLLERR;
+ error= poll(fds, 1, ptr->root->connect_timeout);
+
+ if (error != 1)
+ {
+ ptr->cached_errno= errno;
+ WATCHPOINT_ERRNO(ptr->cached_errno);
+ close(ptr->fd);
+ ptr->fd= -1;
+ return MEMCACHED_ERRNO;
+ }
+
+ break;
+ }
+ /* We are spinning waiting on connect */
case EINTR:
goto test_connect;
case EISCONN: /* We were spinning waiting on connect */
--- /dev/null
+#include "common.h"\r
+\r
+/* \r
+ "Murmur"hash provided by Austin, tanjent@gmail.com\r
+#define MURMUR_POSTMIX\r
+*/\r
+\r
+uint32_t murmur_hash(char *key, size_t length)\r
+{\r
+ const unsigned int m= 0x7fd652ad;\r
+ const int r= 16;\r
+\r
+ uint32_t h= 0xdeadbeef;\r
+\r
+ while(length >= 4)\r
+ {\r
+ h += *(unsigned int *)key;\r
+ h *= m;\r
+ h ^= h >> r;\r
+\r
+ key += 4;\r
+ length -= 4;\r
+ }\r
+\r
+ switch(length)\r
+ {\r
+ case 3:\r
+ h += key[2] << 16;\r
+ case 2:\r
+ h += key[1] << 8;\r
+ case 1:\r
+ default:\r
+ h += key[0];\r
+ h *= m;\r
+ h ^= h >> r;\r
+ };\r
+\r
+#ifdef MURMUR_POSTMIX\r
+\r
+ h *= m;\r
+ h ^= h >> 10;\r
+ h *= m;\r
+ h ^= h >> 17;\r
+\r
+#endif\r
+\r
+ return h;\r
+}\r
void process_hash_option(memcached_st *memc, char *opt_hash)
{
- unsigned int set;
+ uint64_t set;
memcached_return rc;
if (opt_hash == NULL)
exit(1);
}
- rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, &set);
+ rc= memcached_behavior_set(memc, MEMCACHED_BEHAVIOR_HASH, set);
if (rc != MEMCACHED_SUCCESS)
{
fprintf(stderr, "hash: memcache error %s\n", memcached_strerror(memc, rc));