summaryrefslogtreecommitdiff
path: root/libmemcached/purge.cc
diff options
context:
space:
mode:
authorBrian Aker <brian@tangent.org>2011-12-25 12:18:57 -0800
committerBrian Aker <brian@tangent.org>2011-12-25 12:18:57 -0800
commitf3883e19f984baa8981326d9e652d49433d49732 (patch)
tree8403a01d6d07a76a23a599ffb70d14312c136dac /libmemcached/purge.cc
parent6edcc9e0e093c5d082ac76b1dcc73396897f5c24 (diff)
downloadlibmemcached-f3883e19f984baa8981326d9e652d49433d49732.tar.gz
Fix detangle, minor style cleanups.
Diffstat (limited to 'libmemcached/purge.cc')
-rw-r--r--libmemcached/purge.cc50
1 files changed, 46 insertions, 4 deletions
diff --git a/libmemcached/purge.cc b/libmemcached/purge.cc
index 36a33ae9..b0f864a8 100644
--- a/libmemcached/purge.cc
+++ b/libmemcached/purge.cc
@@ -1,4 +1,44 @@
-#include "common.h"
+/* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
+ *
+ * LibMemcached
+ *
+ * Copyright (C) 2011 Data Differential, http://datadifferential.com/
+ * Copyright (C) 2006-2009 Brian Aker
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * * The names of its contributors may not be used to endorse or
+ * promote products derived from this software without specific prior
+ * written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+
+#include <libmemcached/common.h>
+
memcached_return_t memcached_purge(memcached_server_write_instance_st ptr)
{
@@ -18,7 +58,7 @@ memcached_return_t memcached_purge(memcached_server_write_instance_st ptr)
so we need to be able stop any recursion.. */
memcached_set_purging(root, true);
- WATCHPOINT_ASSERT(ptr->fd != -1);
+ WATCHPOINT_ASSERT(ptr->fd != INVALID_SOCKET);
/* Force a flush of the buffer to ensure that we don't have the n-1 pending
requests buffered up.. */
if (memcached_io_write(ptr, NULL, 0, true) == -1)
@@ -27,7 +67,7 @@ memcached_return_t memcached_purge(memcached_server_write_instance_st ptr)
return memcached_set_error(*ptr, MEMCACHED_WRITE_FAILURE, MEMCACHED_AT);
}
- WATCHPOINT_ASSERT(ptr->fd != -1);
+ WATCHPOINT_ASSERT(ptr->fd != INVALID_SOCKET);
uint32_t no_msg= memcached_server_response_count(ptr) - 1;
if (no_msg > 0)
@@ -58,7 +98,7 @@ memcached_return_t memcached_purge(memcached_server_write_instance_st ptr)
* The only kind of errors I care about if is I'm out of sync with the
* protocol or have problems reading data from the network..
*/
- if (rc== MEMCACHED_PROTOCOL_ERROR || rc == MEMCACHED_UNKNOWN_READ_FAILURE)
+ if (rc== MEMCACHED_PROTOCOL_ERROR or rc == MEMCACHED_UNKNOWN_READ_FAILURE or rc == MEMCACHED_READ_FAILURE)
{
WATCHPOINT_ERROR(rc);
ret= rc;
@@ -75,7 +115,9 @@ memcached_return_t memcached_purge(memcached_server_write_instance_st ptr)
{
rc = (*cb.callback[y])(ptr->root, result_ptr, cb.context);
if (rc != MEMCACHED_SUCCESS)
+ {
break;
+ }
}
}
}