diff options
author | pquerna <pquerna@13f79535-47bb-0310-9956-ffa450edef68> | 2007-07-11 00:57:06 +0000 |
---|---|---|
committer | pquerna <pquerna@13f79535-47bb-0310-9956-ffa450edef68> | 2007-07-11 00:57:06 +0000 |
commit | 43023c7f8f9fe5592b4ed779fb927d1b94b6daea (patch) | |
tree | 8d7e7580c729a6f0234d77c6251d97d523602a43 | |
parent | f68c27c01ba005c8b4553dad9664754bdf0854ce (diff) | |
download | libapr-util-mc-binary-protocol-dev.tar.gz |
Fix iovec order and contents to align with the protocol document:mc-binary-protocol-dev
<http://code.sixapart.com/svn/memcached/trunk/server/doc/binary-protocol-plan.txt>
This should move all command specific words to be before the variable length key.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr-util/branches/mc-binary-protocol-dev@555131 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | memcache/apr_memcache.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/memcache/apr_memcache.c b/memcache/apr_memcache.c index 3cfb6b27..16abef44 100644 --- a/memcache/apr_memcache.c +++ b/memcache/apr_memcache.c @@ -609,7 +609,7 @@ static apr_status_t storage_cmd_write(apr_memcache_t *mc, apr_memcache_conn_t *conn; apr_status_t rv; apr_size_t written; - struct iovec vec[4]; + struct iovec vec[5]; int klen; apr_size_t key_size = strlen(key); @@ -638,21 +638,21 @@ static apr_status_t storage_cmd_write(apr_memcache_t *mc, vec[0].iov_base = &hdr; vec[0].iov_len = MC_HDR_LEN; - vec[1].iov_base = (void*)key; - vec[1].iov_len = key_size; - flags = htonl(flags); - vec[2].iov_base = (void*)&flags; - vec[2].iov_len = sizeof(apr_uint32_t); + vec[1].iov_base = (void*)&flags; + vec[1].iov_len = sizeof(apr_uint32_t); timeout = htonl(timeout); vec[2].iov_base = (void*)&timeout; vec[2].iov_len = sizeof(apr_uint32_t); - vec[3].iov_base = data; - vec[3].iov_len = data_size; + vec[3].iov_base = (void*)key; + vec[3].iov_len = key_size; + + vec[4].iov_base = data; + vec[4].iov_len = data_size; - rv = apr_socket_sendv(conn->sock, vec, 4, &written); + rv = apr_socket_sendv(conn->sock, vec, 5, &written); if (rv != APR_SUCCESS) { ms_bad_conn(ms, conn); @@ -930,14 +930,14 @@ static apr_status_t num_cmd_write(apr_memcache_t *mc, vec[0].iov_base = &hdr; vec[0].iov_len = MC_HDR_LEN; - vec[1].iov_base = (void*)key; - vec[1].iov_len = klen; - tinc = htonl(inc); - vec[2].iov_base = (void*)&tinc; - vec[2].iov_len = sizeof(apr_uint32_t); + vec[1].iov_base = (void*)&tinc; + vec[1].iov_len = sizeof(apr_uint32_t); + vec[2].iov_base = (void*)key; + vec[2].iov_len = klen; + rv = apr_socket_sendv(conn->sock, vec, 3, &written); if (rv != APR_SUCCESS) { |