- host->stack_responses= 0;
- host->cursor_active= 0;
- host->hostname= new_hostname;
+ unsigned int x;
+ unsigned int y;
+ unsigned int latch;
+
+ /* Seed the Wheel */
+ memset(ptr->wheel, 0, sizeof(unsigned int) * MEMCACHED_WHEEL_SIZE);
+
+ for (latch= y= x= 0; x < MEMCACHED_WHEEL_SIZE; x++, latch++)
+ {
+ if (latch == MEMCACHED_STRIDE)
+ {
+ y++;
+ if (y == ptr->number_of_hosts)
+ y= 0;
+ latch= 0;
+ }
+
+ ptr->wheel[x]= y;
+ }
+}
+
+static void host_reset(memcached_st *ptr, memcached_server_st *host,
+ char *hostname, unsigned int port,
+ memcached_connection type)
+{
+ memset(host, 0, sizeof(memcached_server_st));
+ strncpy(host->hostname, hostname, MEMCACHED_MAX_HOST_LENGTH - 1);
+ host->root= ptr ? ptr : NULL;