non-block mode.
* 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.16 Mon Feb 18 00:30:25 PST 2008
* Work on the UDP protocol
MEMCACHED_BEHAVIOR_SORT_HOSTS,
MEMCACHED_BEHAVIOR_VERIFY_KEY,
MEMCACHED_BEHAVIOR_CONNECT_TIMEOUT,
+ MEMCACHED_BEHAVIOR_RETRY_TIMEOUT,
} memcached_behavior;
typedef enum {
uint8_t minor_version;
uint8_t micro_version;
uint16_t count;
+ time_t next_retry;
memcached_st *root;
};
int recv_size;
int32_t poll_timeout;
int32_t connect_timeout;
+ int32_t retry_timeout;
memcached_result_st result;
memcached_hash hash;
memcached_server_distribution distribution;
ptr->connect_timeout= timeout;
break;
}
+ case MEMCACHED_BEHAVIOR_RETRY_TIMEOUT:
+ {
+ ptr->retry_timeout= (int32_t)data;
+ break;
+ }
case MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE:
{
ptr->send_size= (*((int *)data));
{
return (unsigned long long)ptr->connect_timeout;
}
+ case MEMCACHED_BEHAVIOR_RETRY_TIMEOUT:
+ {
+ return (unsigned long long)ptr->retry_timeout;
+ }
case MEMCACHED_BEHAVIOR_SOCKET_SEND_SIZE:
{
int sock_size;
WATCHPOINT_ERRNO(ptr->cached_errno);
close(ptr->fd);
ptr->fd= -1;
+ if (ptr->root->retry_timeout)
+ {
+ struct timeval next_time;
+
+ gettimeofday(&next_time, NULL);
+ ptr->next_retry= next_time.tv_sec + ptr->root->retry_timeout;
+ }
}
}
else
memcached_return rc= MEMCACHED_NO_SERVERS;
LIBMEMCACHED_MEMCACHED_CONNECT_START();
+ if (ptr->root->retry_timeout)
+ {
+ struct timeval next_time;
+
+ gettimeofday(&next_time, NULL);
+ if (next_time.tv_sec < ptr->next_retry)
+ return MEMCACHED_TIMEOUT;
+ }
/* We need to clean up the multi startup piece */
switch (ptr->type)
{
host->fd= -1;
host->type= type;
host->read_ptr= host->read_buffer;
+ if (ptr)
+ host->next_retry= ptr->retry_timeout;
host->sockaddr_inited= MEMCACHED_NOT_ALLOCATED;
}