You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by pq...@apache.org on 2006/08/03 22:52:28 UTC
svn commit: r428526 - /apr/apr-util/trunk/memcache/apr_memcache.c
Author: pquerna
Date: Thu Aug 3 13:52:27 2006
New Revision: 428526
URL: http://svn.apache.org/viewvc?rev=428526&view=rev
Log:
When destructing a connection in the reslist, send "quit" to the memcache node, to be nice about closing the socket.
Modified:
apr/apr-util/trunk/memcache/apr_memcache.c
Modified: apr/apr-util/trunk/memcache/apr_memcache.c
URL: http://svn.apache.org/viewvc/apr/apr-util/trunk/memcache/apr_memcache.c?rev=428526&r1=428525&r2=428526&view=diff
==============================================================================
--- apr/apr-util/trunk/memcache/apr_memcache.c (original)
+++ apr/apr-util/trunk/memcache/apr_memcache.c Thu Aug 3 13:52:27 2006
@@ -65,6 +65,9 @@
#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 @@
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;
}