return MEMCACHED_SUCCESS;
}
- ssize_t sent_length= memcached_io_writev(instance, vector, count, with_flush);
- size_t command_length= 0;
- for (uint32_t x= 0; x < count; ++x, vector++)
- {
- command_length+= vector->length;
- }
-
- if (sent_length == -1 or size_t(sent_length) != command_length)
+ bool sent_success= memcached_io_writev(instance, vector, count, with_flush);
+ if (sent_success == false)
{
if (memcached_last_error(instance->root) == MEMCACHED_SUCCESS)
{
}
hosts_connected++;
- if ((memcached_io_writev(instance, vector, 4, false)) == -1)
+ if ((memcached_io_writev(instance, vector, 4, false)) == false)
{
failures_occured_in_sending= true;
continue;
}
else
{
- if ((memcached_io_writev(instance, (vector + 1), 3, false)) == -1)
+ if ((memcached_io_writev(instance, (vector + 1), 3, false)) == false)
{
memcached_server_response_reset(instance);
failures_occured_in_sending= true;
{ keys[x], key_length[x] }
};
- if (memcached_io_writev(instance, vector, 3, flush) == -1)
+ if (memcached_io_writev(instance, vector, 3, flush) == false)
{
memcached_server_response_reset(instance);
rc= MEMCACHED_SOME_ERRORS;
{ keys[x], key_length[x] }
};
- if (memcached_io_writev(instance, vector, 3, true) == -1)
+ if (memcached_io_writev(instance, vector, 3, true) == false)
{
memcached_io_reset(instance);
dead_servers[server]= true;
/* fall through */
case ENOTCONN: // Programmer Error
- WATCHPOINT_ASSERT(0);
+ assert(0);
case ENOTSOCK:
- WATCHPOINT_ASSERT(0);
+ assert(0);
case EBADF:
assert_msg(ptr->fd != INVALID_SOCKET, "Invalid socket state");
case EINVAL:
return ssize_t(written);
}
-ssize_t memcached_io_writev(memcached_server_write_instance_st ptr,
+bool memcached_io_writev(memcached_server_write_instance_st ptr,
libmemcached_io_vector_st vector[],
const size_t number_of, const bool with_flush)
{
+ ssize_t complete_total= 0;
ssize_t total= 0;
for (size_t x= 0; x < number_of; x++, vector++)
{
+ complete_total+= vector->length;
if (vector->length)
{
size_t written;
if ((_io_write(ptr, vector->buffer, vector->length, false, written)) == false)
{
- return -1;
+ return false;
}
total+= written;
}
{
if (memcached_io_write(ptr) == false)
{
- return -1;
+ return false;
}
}
- return total;
+ return (complete_total == total);
}
ssize_t memcached_io_write(memcached_server_write_instance_st ptr,
const void *buffer, size_t length, bool with_flush);
-ssize_t memcached_io_writev(memcached_server_write_instance_st ptr,
- libmemcached_io_vector_st vector[],
- const size_t number_of, const bool with_flush);
+bool memcached_io_writev(memcached_server_write_instance_st ptr,
+ libmemcached_io_vector_st vector[],
+ const size_t number_of, const bool with_flush);
memcached_return_t memcached_io_wait_for_write(memcached_server_write_instance_st ptr);
{ data, len }
};
- if (memcached_io_writev(server, vector, 3, true) == -1)
+ if (memcached_io_writev(server, vector, 3, true) == false)
{
rc= MEMCACHED_WRITE_FAILURE;
break;