X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=lib%2Fmemcached_storage.c;h=f9ba64d6db358467523f1098417c63d427c57bbe;hb=1bd637f6eccc1064a4e19e40b14a340818d1ccf3;hp=5a8701fafb25a350bf5e5b870af4d0a82444f2f7;hpb=9e9572af3e9be02dd3de5c71bf1665217a770e1b;p=m6w6%2Flibmemcached diff --git a/lib/memcached_storage.c b/lib/memcached_storage.c index 5a8701fa..f9ba64d6 100644 --- a/lib/memcached_storage.c +++ b/lib/memcached_storage.c @@ -26,23 +26,22 @@ static memcached_return memcached_send(memcached_st *ptr, uint16_t flags, memcached_storage_action verb) { + char to_write; size_t write_length; ssize_t sent_length; memcached_return rc; char buffer[MEMCACHED_DEFAULT_COMMAND_SIZE]; unsigned int server_key; - assert(value); - assert(value_length); + WATCHPOINT_ASSERT(value); + WATCHPOINT_ASSERT(value_length); - /* Leaving this assert in since only a library fubar could blow this */ - if (ptr->write_buffer_offset != 0) - { - WATCHPOINT_NUMBER(ptr->write_buffer_offset); - } + /* Leaving this WATCHPOINT_ASSERT in since only a library fubar could blow this */ +#ifdef NOT_DONE + if (!(ptr->flags & MEM_NO_BLOCK) && ptr->write_buffer_offset != 0) + WATCHPOINT_ASSERT(0); +#endif - assert(ptr->write_buffer_offset == 0); - server_key= memcached_generate_hash(ptr, key, key_length); rc= memcached_connect(ptr, server_key); @@ -75,7 +74,12 @@ static memcached_return memcached_send(memcached_st *ptr, goto error; } - if ((sent_length= memcached_io_write(ptr, server_key, "\r\n", 2, 1)) == -1) + if ((ptr->flags & MEM_NO_BLOCK) && verb == SET_OP) + to_write= 0; + else + to_write= 1; + + if ((sent_length= memcached_io_write(ptr, server_key, "\r\n", 2, to_write)) == -1) { memcached_quit_server(ptr, server_key); rc= MEMCACHED_WRITE_FAILURE;