Remove assert
[m6w6/libmemcached] / libmemcached / quit.cc
index fa7599ede2a0f5d4b15e858930ed65531f9444de..9aadd605f71ea802009686c1b20bb897507b2203 100644 (file)
@@ -50,7 +50,7 @@ void memcached_quit_server(memcached_server_st *ptr, bool io_death)
 {
   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)
     {
       ptr->options.is_shutting_down= true;
 
@@ -61,11 +61,22 @@ void memcached_quit_server(memcached_server_st *ptr, bool io_death)
         request.message.header.request.magic = PROTOCOL_BINARY_REQ;
         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
       {
-        rc= memcached_do(ptr, memcached_literal_param("quit\r\n"), true);
+        libmemcached_io_vector_st vector[]=
+        {
+          { memcached_literal_param("quit\r\n") }
+        };
+
+        rc= memcached_vdo(ptr, vector, 1, true);
       }
 
       WATCHPOINT_ASSERT(rc == MEMCACHED_SUCCESS or rc == MEMCACHED_FETCH_NOTFINISHED);
@@ -100,7 +111,7 @@ void memcached_quit_server(memcached_server_st *ptr, bool io_death)
   ptr->state= MEMCACHED_SERVER_STATE_NEW;
   ptr->cursor_active= 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;
@@ -112,8 +123,7 @@ void memcached_quit_server(memcached_server_st *ptr, bool io_death)
 
   if (io_death)
   {
-    ptr->server_failure_counter++;
-    set_last_disconnected_host(ptr);
+    memcached_mark_server_for_timeout(ptr);
   }
 }
 
@@ -130,7 +140,8 @@ void send_quit(memcached_st *ptr)
 
 void memcached_quit(memcached_st *ptr)
 {
-  if (memcached_failed(initialize_query(ptr)))
+  memcached_return_t rc;
+  if (memcached_failed(rc= initialize_query(ptr, true)))
   {
     return;
   }