projects
/
awesomized
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Merge in 1.0.3
[awesomized/libmemcached]
/
libmemcached
/
do.cc
diff --git
a/libmemcached/do.cc
b/libmemcached/do.cc
index a51472ba66562a50a18353b1c843bd5c3a3afd7c..3c3519c27b9cccb29df440a9e4719735bb3be424 100644
(file)
--- a/
libmemcached/do.cc
+++ b/
libmemcached/do.cc
@@
-12,14
+12,13
@@
#include <libmemcached/common.h>
memcached_return_t memcached_vdo(memcached_server_write_instance_st instance,
#include <libmemcached/common.h>
memcached_return_t memcached_vdo(memcached_server_write_instance_st instance,
- libmemcached_io_vector_st
*vector
,
+ libmemcached_io_vector_st
vector[]
,
const size_t count,
const bool with_flush)
{
memcached_return_t rc;
const size_t count,
const bool with_flush)
{
memcached_return_t rc;
- WATCHPOINT_ASSERT(count);
- WATCHPOINT_ASSERT(vector);
+ assert_msg(vector, "Invalid vector passed");
if (memcached_failed(rc= memcached_connect(instance)))
{
if (memcached_failed(rc= memcached_connect(instance)))
{
@@
-35,20
+34,28
@@
memcached_return_t memcached_vdo(memcached_server_write_instance_st instance,
**/
if (memcached_is_udp(instance->root))
{
**/
if (memcached_is_udp(instance->root))
{
- if (vector
->buffer or vector->
length)
+ if (vector
[0].buffer or vector[0].
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"));
}
{
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;
+ struct msghdr msg;
+ memset(&msg, 0, sizeof(msg));
- if (write_length > MAX_UDP_DATAGRAM_LENGTH - UDP_DATAGRAM_HEADER_LENGTH)
+ increment_udp_message_id(instance);
+ vector[0].buffer= instance->write_buffer;
+ vector[0].length= UDP_DATAGRAM_HEADER_LENGTH;
+
+ msg.msg_iov= (struct iovec*)vector;
+ msg.msg_iovlen= count;
+
+ if (::sendmsg(instance->fd, &msg, 0) < 1)
{
{
- return
MEMCACHED_WRITE_FAILURE
;
+ return
memcached_set_error(*instance, MEMCACHED_WRITE_FAILURE, MEMCACHED_AT)
;
}
}
- return MEMCACHED_
NOT_SUPPORTED
;
+ return MEMCACHED_
SUCCESS
;
}
ssize_t sent_length= memcached_io_writev(instance, vector, count, with_flush);
}
ssize_t sent_length= memcached_io_writev(instance, vector, count, with_flush);