summaryrefslogtreecommitdiff
path: root/memcache
diff options
context:
space:
mode:
authorpquerna <pquerna@13f79535-47bb-0310-9956-ffa450edef68>2006-08-03 20:52:27 +0000
committerpquerna <pquerna@13f79535-47bb-0310-9956-ffa450edef68>2006-08-03 20:52:27 +0000
commit8aefc32cdb8c36b013d40e547dc9053669d273a8 (patch)
tree9a4c011494d7f7de58f3dd2ef53505ff23d2252a /memcache
parentce7dc7ca2697c10fd14c02a887459850657d505d (diff)
downloadlibapr-util-8aefc32cdb8c36b013d40e547dc9053669d273a8.tar.gz
When destructing a connection in the reslist, send "quit" to the memcache node, to be nice about closing the socket.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr-util/trunk@428526 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'memcache')
-rw-r--r--memcache/apr_memcache.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/memcache/apr_memcache.c b/memcache/apr_memcache.c
index 72a87eb6..4374ad94 100644
--- a/memcache/apr_memcache.c
+++ b/memcache/apr_memcache.c
@@ -65,6 +65,9 @@ struct apr_memcache_conn_t
#define MC_STATS "stats"
#define MC_STATS_LEN (sizeof(MC_STATS)-1)
+#define MC_QUIT "quit"
+#define MC_QUIT_LEN (sizeof(MC_QUIT)-1)
+
/* Strings for Server Replies */
#define MS_STORED "STORED"
@@ -314,7 +317,21 @@ mc_conn_construct(void **conn_, void *params, apr_pool_t *pool)
static apr_status_t
mc_conn_destruct(void *conn_, void *params, apr_pool_t *pool)
{
- /* Currently a NOOP */
+ apr_memcache_conn_t *conn = (apr_memcache_conn_t*)conn_;
+ struct iovec vec[2];
+ apr_size_t written;
+
+ /* send a quit message to the memcached server to be nice about it. */
+ vec[0].iov_base = MC_QUIT;
+ vec[0].iov_len = MC_QUIT_LEN;
+
+ vec[1].iov_base = MC_EOL;
+ vec[1].iov_len = MC_EOL_LEN;
+
+ /* Return values not checked, since we just want to make it go away. */
+ apr_socket_sendv(conn->sock, vec, 2, &written);
+ apr_socket_close(conn->sock);
+
return APR_SUCCESS;
}