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 2007/07/11 02:57:07 UTC

svn commit: r555131 - /apr/apr-util/branches/mc-binary-protocol-dev/memcache/apr_memcache.c

Author: pquerna
Date: Tue Jul 10 17:57:06 2007
New Revision: 555131

URL: http://svn.apache.org/viewvc?view=rev&rev=555131
Log:
Fix iovec order and contents to align with the protocol document:
 <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.

Modified:
    apr/apr-util/branches/mc-binary-protocol-dev/memcache/apr_memcache.c

Modified: apr/apr-util/branches/mc-binary-protocol-dev/memcache/apr_memcache.c
URL: http://svn.apache.org/viewvc/apr/apr-util/branches/mc-binary-protocol-dev/memcache/apr_memcache.c?view=diff&rev=555131&r1=555130&r2=555131
==============================================================================
--- apr/apr-util/branches/mc-binary-protocol-dev/memcache/apr_memcache.c (original)
+++ apr/apr-util/branches/mc-binary-protocol-dev/memcache/apr_memcache.c Tue Jul 10 17:57:06 2007
@@ -609,7 +609,7 @@
     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 @@
     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 @@
     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) {