apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pque...@apache.org
Subject svn commit: r555130 - /apr/apr-util/branches/mc-binary-protocol-dev/memcache/apr_memcache.c
Date Wed, 11 Jul 2007 00:53:52 GMT
Author: pquerna
Date: Tue Jul 10 17:53:51 2007
New Revision: 555130

URL: http://svn.apache.org/viewvc?view=rev&rev=555130
Log:
Convert all flags, timeouts, and increment counts to and from network byte order.

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=555130&r1=555129&r2=555130
==============================================================================
--- 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:53:51
2007
@@ -641,9 +641,11 @@
     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);
     
+    timeout = htonl(timeout);
     vec[2].iov_base = (void*)&timeout;
     vec[2].iov_len  = sizeof(apr_uint32_t);
 
@@ -810,6 +812,7 @@
         
         *new_length = len - 1 - 4;
         memcpy(flags, *baton, 4);
+        *flags = ntohl(*flags);
         *baton =  *baton + 4;
         (*baton)[*new_length] = '\0';
     }
@@ -895,6 +898,7 @@
                                   const apr_int32_t inc,
                                   apr_uint32_t *new_value)
 {
+    apr_uint32_t tinc;
     apr_mc_hdr_t hdr;
     apr_status_t rv;
     apr_memcache_server_t *ms;
@@ -928,9 +932,11 @@
     
     vec[1].iov_base = (void*)key;
     vec[1].iov_len  = klen;
-
-    vec[2].iov_base = (void*)&inc;
-    vec[2].iov_len  = sizeof(inc);
+    
+    tinc = htonl(inc);
+    
+    vec[2].iov_base = (void*)&tinc;
+    vec[2].iov_len  = sizeof(apr_uint32_t);
 
     rv = apr_socket_sendv(conn->sock, vec, 3, &written);
 
@@ -973,7 +979,9 @@
                 apr_memcache_disable_server(mc, ms);
                 return rv;
             }
-
+            
+            *new_value = ntohl(*new_value);
+            
             apr_brigade_cleanup(conn->tb);
         }
     }



Mime
View raw message