Remove a dead udp check
authorBrian Aker <brian@tangent.org>
Sat, 31 Dec 2011 01:19:55 +0000 (17:19 -0800)
committerBrian Aker <brian@tangent.org>
Sat, 31 Dec 2011 01:19:55 +0000 (17:19 -0800)
libmemcached/delete.cc
libmemcached/do.cc

index 9baf56b85b3bc3962d8d4df4811b5ac2040902c6..121ec91bf0e550bdf8c871c8cdc8452ff2ab6739 100644 (file)
@@ -61,21 +61,6 @@ static inline memcached_return_t ascii_delete(memcached_server_write_instance_st
     { memcached_literal_param("\r\n") }
   };
 
-  if (memcached_is_udp(instance->root))
-  {
-    size_t send_length= io_vector_total_size(vector, 6);
-
-    if (send_length > MAX_UDP_DATAGRAM_LENGTH - UDP_DATAGRAM_HEADER_LENGTH)
-    {
-      return MEMCACHED_WRITE_FAILURE;
-    }
-
-    if (send_length +instance->write_buffer_offset > MAX_UDP_DATAGRAM_LENGTH)
-    {
-      memcached_io_write(instance);
-    }
-  }
-
   /* Send command header */
   return memcached_vdo(instance, vector, 6, flush);
 }
@@ -102,20 +87,6 @@ static inline memcached_return_t binary_delete(memcached_server_write_instance_s
   request.message.header.request.datatype= PROTOCOL_BINARY_RAW_BYTES;
   request.message.header.request.bodylen= htonl((uint32_t)(key_length + memcached_array_size(instance->root->_namespace)));
 
-  if (memcached_is_udp(instance->root))
-  {
-    size_t cmd_size= sizeof(request.bytes) + key_length;
-    if (cmd_size > MAX_UDP_DATAGRAM_LENGTH - UDP_DATAGRAM_HEADER_LENGTH)
-    {
-      return MEMCACHED_WRITE_FAILURE;
-    }
-
-    if (cmd_size +instance->write_buffer_offset > MAX_UDP_DATAGRAM_LENGTH)
-    {
-      memcached_io_write(instance);
-    }
-  }
-
   libmemcached_io_vector_st vector[]=
   {
     { NULL, 0 },
index a793268dba1dc7c0781a89f91bec8bafcbbbde16..a51472ba66562a50a18353b1c843bd5c3a3afd7c 100644 (file)
@@ -35,6 +35,12 @@ memcached_return_t memcached_vdo(memcached_server_write_instance_st instance,
   **/
   if (memcached_is_udp(instance->root))
   {
+    if (vector->buffer or vector->length)
+    {
+      return memcached_set_error(*instance->root, MEMCACHED_NOT_SUPPORTED, MEMCACHED_AT, 
+                                 memcached_literal_param("UDP messages was attempted, but vector was not setup for it"));
+    }
+
     size_t write_length= io_vector_total_size(vector, 11) +UDP_DATAGRAM_HEADER_LENGTH;
 
     if (write_length > MAX_UDP_DATAGRAM_LENGTH - UDP_DATAGRAM_HEADER_LENGTH)