- if ((sent_length= send(ptr->hosts[server_key].fd, value, value_length, 0)) == -1)
- return MEMCACHED_WRITE_FAILURE;
- assert(value_length == sent_length);
+ /*
+ We have to flush after sending the command. Memcached is not smart enough
+ to just keep reading from the socket :(
+ */
+ if ((sent_length= memcached_io_write(ptr, server_key, buffer, write_length, 1)) == -1)
+ {
+ rc= MEMCACHED_WRITE_FAILURE;
+ goto error;
+ }