projects
/
awesomized
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Fix all include location, and drop versions of the library that were never shipped.
[awesomized/libmemcached]
/
libmemcached
/
quit.cc
diff --git
a/libmemcached/quit.cc
b/libmemcached/quit.cc
index cd5d9ecd9e7275dcb20a235de8936a22e2c382f8..77924fb4930ee277bf4c3a506e8bd6d0ca78884c 100644
(file)
--- a/
libmemcached/quit.cc
+++ b/
libmemcached/quit.cc
@@
-46,32
+46,40
@@
will force data to be completed.
*/
will force data to be completed.
*/
-void memcached_quit_server(
memcached_server_st *
ptr, bool io_death)
+void memcached_quit_server(
org::libmemcached::Instance*
ptr, bool io_death)
{
if (ptr->fd != INVALID_SOCKET)
{
{
if (ptr->fd != INVALID_SOCKET)
{
- if (io_death == false
&& ptr->type != MEMCACHED_CONNECTION_UDP &&
ptr->options.is_shutting_down == false)
+ if (io_death == false
and memcached_is_udp(ptr->root) == false and
ptr->options.is_shutting_down == false)
{
{
- memcached_return_t rc;
- char buffer[MEMCACHED_MAX_BUFFER];
-
ptr->options.is_shutting_down= true;
ptr->options.is_shutting_down= true;
+ memcached_return_t rc;
if (ptr->root->flags.binary_protocol)
{
protocol_binary_request_quit request= {}; // = {.bytes= {0}};
if (ptr->root->flags.binary_protocol)
{
protocol_binary_request_quit request= {}; // = {.bytes= {0}};
- request.message.header.request.magic = PROTOCOL_BINARY_REQ;
+
+ initialize_binary_request(ptr, request.message.header);
+
request.message.header.request.opcode = PROTOCOL_BINARY_CMD_QUIT;
request.message.header.request.datatype = PROTOCOL_BINARY_RAW_BYTES;
request.message.header.request.opcode = PROTOCOL_BINARY_CMD_QUIT;
request.message.header.request.datatype = PROTOCOL_BINARY_RAW_BYTES;
- rc= memcached_do(ptr, request.bytes, sizeof(request.bytes), true);
+
+ libmemcached_io_vector_st vector[]=
+ {
+ { request.bytes, sizeof(request.bytes) }
+ };
+
+ rc= memcached_vdo(ptr, vector, 1, true);
}
else
{
}
else
{
- rc= memcached_do(ptr, "quit\r\n", sizeof("quit\r\n") -1, true);
- }
+ libmemcached_io_vector_st vector[]=
+ {
+ { memcached_literal_param("quit\r\n") }
+ };
-
WATCHPOINT_ASSERT(rc == MEMCACHED_SUCCESS || rc == MEMCACHED_FETCH_NOTFINISHED
);
- (void)rc; // Shut up ICC
+
rc= memcached_vdo(ptr, vector, 1, true
);
+ }
/* read until socket is closed, or there is an error
* closing the socket before all data is read
/* read until socket is closed, or there is an error
* closing the socket before all data is read
@@
-81,14
+89,20
@@
void memcached_quit_server(memcached_server_st *ptr, bool io_death)
* In .40 we began to only do this if we had been doing buffered
* requests of had replication enabled.
*/
* In .40 we began to only do this if we had been doing buffered
* requests of had replication enabled.
*/
- if (
ptr->root->flags.buffer_requests || ptr->root->number_of_replicas
)
+ if (
memcached_success(rc) and (ptr->root->flags.buffer_requests or ptr->root->number_of_replicas)
)
{
{
- ssize_t nread;
- while (memcached_io_read(ptr, buffer, sizeof(buffer)/sizeof(*buffer),
- &nread) == MEMCACHED_SUCCESS) {} ;
+ if (0)
+ {
+ memcached_return_t rc_slurp;
+ while (memcached_continue(rc_slurp= memcached_io_slurp(ptr))) {} ;
+ WATCHPOINT_ASSERT(rc_slurp == MEMCACHED_CONNECTION_FAILURE);
+ }
+ else
+ {
+ memcached_io_slurp(ptr);
+ }
}
}
-
/*
* memcached_io_read may call memcached_quit_server with io_death if
* it encounters problems, but we don't care about those occurences.
/*
* memcached_io_read may call memcached_quit_server with io_death if
* it encounters problems, but we don't care about those occurences.
@@
-101,9
+115,10
@@
void memcached_quit_server(memcached_server_st *ptr, bool io_death)
memcached_io_close(ptr);
}
memcached_io_close(ptr);
}
- ptr->fd= INVALID_SOCKET;
+ ptr->state= MEMCACHED_SERVER_STATE_NEW;
+ ptr->cursor_active_= 0;
ptr->io_bytes_sent= 0;
ptr->io_bytes_sent= 0;
- ptr->write_buffer_offset=
(size_t) ((ptr->type == MEMCACHED_CONNECTION_UDP
) ? UDP_DATAGRAM_HEADER_LENGTH : 0);
+ ptr->write_buffer_offset=
size_t(ptr->root and memcached_is_udp(ptr->root
) ? UDP_DATAGRAM_HEADER_LENGTH : 0);
ptr->read_buffer_length= 0;
ptr->read_ptr= ptr->read_buffer;
ptr->options.is_shutting_down= false;
ptr->read_buffer_length= 0;
ptr->read_ptr= ptr->read_buffer;
ptr->options.is_shutting_down= false;
@@
-115,8
+130,7
@@
void memcached_quit_server(memcached_server_st *ptr, bool io_death)
if (io_death)
{
if (io_death)
{
- ptr->server_failure_counter++;
- set_last_disconnected_host(ptr);
+ memcached_mark_server_for_timeout(ptr);
}
}
}
}
@@
-124,8
+138,7
@@
void send_quit(memcached_st *ptr)
{
for (uint32_t x= 0; x < memcached_server_count(ptr); x++)
{
{
for (uint32_t x= 0; x < memcached_server_count(ptr); x++)
{
- memcached_server_write_instance_st instance=
- memcached_server_instance_fetch(ptr, x);
+ org::libmemcached::Instance* instance= memcached_instance_fetch(ptr, x);
memcached_quit_server(instance, false);
}
memcached_quit_server(instance, false);
}
@@
-133,7
+146,8
@@
void send_quit(memcached_st *ptr)
void memcached_quit(memcached_st *ptr)
{
void memcached_quit(memcached_st *ptr)
{
- if (initialize_query(ptr) != MEMCACHED_SUCCESS)
+ memcached_return_t rc;
+ if (memcached_failed(rc= initialize_query(ptr, true)))
{
return;
}
{
return;
}