memc so that we don't do any sort of overflow by accident.
return run_distribution(ptr);
}
+
+memcached_return_t memcached_server_add_parsed(memcached_st *ptr,
+ const char *hostname,
+ size_t hostname_length,
+ in_port_t port,
+ uint32_t weight)
+{
+ char buffer[NI_MAXHOST];
+
+ memcpy(buffer, hostname, hostname_length);
+ buffer[hostname_length]= 0;
+
+ return server_add(ptr, buffer,
+ port,
+ weight,
+ MEMCACHED_CONNECTION_TCP);
+}
expression:
SERVER '=' server
{
- (void) memcached_server_add(parser->memc, $3.c_str, $3.port);
+ (void) memcached_server_add_parsed(parser->memc, $3.c_str, $3.length, $3.port, 0);
}
| SERVERS '=' server_list
{ }
server_list:
server
{
- (void) memcached_server_add(parser->memc, $1.c_str, $1.port);
+ (void) memcached_server_add_parsed(parser->memc, $1.c_str, $1.length, $1.port, 0);
}
| server_list ',' server
{
- (void) memcached_server_add(parser->memc, $3.c_str, $3.port);
+ (void) memcached_server_add_parsed(parser->memc, $3.c_str, $3.length, $3.port, 0);
}
;
memcached_return_t memcached_server_add(memcached_st *ptr,
const char *hostname, in_port_t port);
+LIBMEMCACHED_LOCAL
+ memcached_return_t memcached_server_add_parsed(memcached_st *ptr,
+ const char *hostname,
+ size_t hostname_length,
+ in_port_t port,
+ uint32_t weight);
+
LIBMEMCACHED_API
memcached_return_t memcached_server_add_udp_with_weight(memcached_st *ptr,
const char *hostname,
scanner_string_st test_strings[]= {
{ STRING_WITH_LEN("--servers=localhost:11221,localhost:11222,localhost:11223,localhost:11224,localhost:11225") },
- { STRING_WITH_LEN("--servers=a.example.com:80,localhost:80,b.example.com") },
+ { STRING_WITH_LEN("--servers=a.example.com:81,localhost:82,b.example.com") },
{ STRING_WITH_LEN("--servers=localhost,localhost:80") },
{ NULL, 0}
};
memcached_server_fn callbacks[1];
callbacks[0]= server_print_callback;
- memcached_server_cursor(memc, callbacks, memc, 1);
+ memcached_server_cursor(memc, callbacks, NULL, 1);
memcached_servers_reset(memc);
}