Lingerd is now working well with fcntl() in order to get async close.
return MEMCACHED_CONNECTION_SOCKET_CREATE_FAILURE;
}
- /* For the moment, not getting a nonblocking mode will not be fatal */
- if (ptr->flags & MEM_NO_BLOCK)
- {
- int flags;
-
- flags= fcntl(ptr->hosts[server_key].fd, F_GETFL, 0);
- if (flags != -1)
- {
- (void)fcntl(ptr->hosts[server_key].fd, F_SETFL, flags | O_NONBLOCK);
- }
- }
-
if (ptr->flags & MEM_NO_BLOCK)
{
int error;
struct linger linger;
linger.l_onoff= 1;
- linger.l_linger= 400;
+ linger.l_linger= 65536;
error= setsockopt(ptr->hosts[server_key].fd, SOL_SOCKET, SO_LINGER,
&linger, (socklen_t)sizeof(struct linger));
WATCHPOINT_ASSERT(error == 0);
WATCHPOINT_ASSERT(error == 0);
}
+ /* For the moment, not getting a nonblocking mode will not be fatal */
+ if (ptr->flags & MEM_NO_BLOCK)
+ {
+ int flags;
+
+ flags= fcntl(ptr->hosts[server_key].fd, F_GETFL, 0);
+ if (flags != -1)
+ {
+ (void)fcntl(ptr->hosts[server_key].fd, F_SETFL, flags | O_NONBLOCK);
+ }
+ }
+
+
/* connect to server */
test_connect:
if (connect(ptr->hosts[server_key].fd,
memcached_return memcached_io_close(memcached_st *ptr, unsigned int server_key)
{
- if (ptr->flags & MEM_NO_BLOCK && 0)
- {
- int sock_size;
- int error;
- socklen_t sock_length;
-
- error= getsockopt(ptr->hosts[server_key].fd, IPPROTO_TCP, SO_LINGER,
- &sock_size, &sock_length);
-
- WATCHPOINT_NUMBER(error);
- WATCHPOINT_NUMBER(sock_size);
- }
-
close(ptr->hosts[server_key].fd);
return MEMCACHED_SUCCESS;
memcached_io_close(ptr, server_key);
}
+ else
+ WATCHPOINT_ASSERT(0);
+
ptr->hosts[server_key].fd= -1;
ptr->hosts[server_key].stack_responses= 0;
ptr->hosts[server_key].cursor_active= 0;
return 0;
}
+uint8_t add_wrapper(memcached_st *memc)
+{
+ unsigned int x;
+
+ for (x= 0; x < 10000; x++)
+ add_test(memc);
+
+ return 0;
+}
+
uint8_t replace_test(memcached_st *memc)
{
memcached_return rc;
{0, 0, 0}
};
+test_st async_tests[] ={
+ {"add", 1, add_wrapper },
+ {0, 0, 0}
+};
+
test_st string_tests[] ={
{"string static with null", 0, string_static_null },
{"string alloc with null", 0, string_alloc_null },
{"version_1_2_3", check_for_1_2_3, 0, version_1_2_3},
{"string", 0, 0, string_tests},
{"result", 0, 0, result_tests},
+ {"async", pre_nonblock, 0, async_tests},
{"user", 0, 0, user_tests},
{"generate", 0, 0, generate_tests},
{"generate_hsieh", pre_hsieh, 0, generate_tests},