From fd8a1d785722f36d111915b0c96331e907df2746 Mon Sep 17 00:00:00 2001 From: Brian Aker Date: Fri, 30 Dec 2011 17:19:55 -0800 Subject: [PATCH] Remove a dead udp check --- libmemcached/delete.cc | 29 ----------------------------- libmemcached/do.cc | 6 ++++++ 2 files changed, 6 insertions(+), 29 deletions(-) diff --git a/libmemcached/delete.cc b/libmemcached/delete.cc index 9baf56b8..121ec91b 100644 --- a/libmemcached/delete.cc +++ b/libmemcached/delete.cc @@ -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 }, diff --git a/libmemcached/do.cc b/libmemcached/do.cc index a793268d..a51472ba 100644 --- a/libmemcached/do.cc +++ b/libmemcached/do.cc @@ -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) -- 2.30.2