From: Brian Aker Date: Sat, 31 Dec 2011 01:19:55 +0000 (-0800) Subject: Remove a dead udp check X-Git-Tag: 1.0.3~3^2~1^2~4 X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=fd8a1d785722f36d111915b0c96331e907df2746;p=m6w6%2Flibmemcached Remove a dead udp check --- 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)