[memcached] plindner, r499: merge in 496:498

commits at code.sixapart.com commits at code.sixapart.com
Thu Apr 12 17:38:47 UTC 2007


merge in 496:498

U   branches/multithreaded/server/ChangeLog
U   branches/multithreaded/server/doc/protocol.txt
U   branches/multithreaded/server/memcached.c


Modified: branches/multithreaded/server/ChangeLog
===================================================================
--- branches/multithreaded/server/ChangeLog	2007-04-12 17:35:06 UTC (rev 498)
+++ branches/multithreaded/server/ChangeLog	2007-04-12 17:38:46 UTC (rev 499)
@@ -1,8 +1,8 @@
 2007-04-12  Paul Lindner  <lindner at mirth.inuus.com>
 
 	* Allow changes to the verbosity level of the server with a new
-	  "verbosity" command.  Patch contributed by Paolo Borelli
-	  <paolo.borelli at gmail.com>.
+	  "verbosity" command and some compiler cleanups. 
+          Patch contributed by Paolo Borelli <paolo.borelli at gmail.com>.
 
 2007-04-08  Paul Lindner  <lindner at inuus.com>
 

Modified: branches/multithreaded/server/doc/protocol.txt
===================================================================
--- branches/multithreaded/server/doc/protocol.txt	2007-04-12 17:35:06 UTC (rev 498)
+++ branches/multithreaded/server/doc/protocol.txt	2007-04-12 17:38:46 UTC (rev 499)
@@ -399,15 +399,10 @@
 "VERSION <version>\r\n", where <version> is the version string for the
 server.
 
-"verbosity" is a command with one argument, the verbosity level:
+"verbosity" is a command with a numeric argument. It always                                                  
+succeeds, and the server sends "OK\r\n" in response. Its effect is to                                        
+set the verbosity level of the logging output.                                                               
 
-verbosity 2\r\n
-
-In response, the server sends
-
-"DONE"
-
-
 "quit" is a command with no arguments:
 
 quit\r\n

Modified: branches/multithreaded/server/memcached.c
===================================================================
--- branches/multithreaded/server/memcached.c	2007-04-12 17:35:06 UTC (rev 498)
+++ branches/multithreaded/server/memcached.c	2007-04-12 17:38:46 UTC (rev 499)
@@ -465,10 +465,12 @@
         return;
 
     if (c->rsize > READ_BUFFER_HIGHWAT && c->rbytes < DATA_BUFFER_SIZE) {
+        char *newbuf;
+
         if (c->rcurr != c->rbuf)
             memmove(c->rbuf, c->rcurr, (size_t)c->rbytes);
 
-        char *newbuf = (char *)realloc((void *)c->rbuf, DATA_BUFFER_SIZE);
+        newbuf = (char *)realloc((void *)c->rbuf, DATA_BUFFER_SIZE);
 
         if (newbuf) {
             c->rbuf = newbuf;
@@ -651,7 +653,7 @@
 
 
 static void out_string(conn *c, const char *str) {
-    int len;
+    size_t len;
 
     assert(c != NULL);
 
@@ -665,8 +667,8 @@
         len = strlen(str);
     }
 
-    strcpy(c->wbuf, str);
-    strcpy(c->wbuf + len, "\r\n");
+    memcpy(c->wbuf, str, len);
+    memcpy(c->wbuf + len, "\r\n", 2);
     c->wbytes = len + 2;
     c->wcurr = c->wbuf;
 
@@ -1418,7 +1420,7 @@
 
     level = strtoul(tokens[1].value, NULL, 10);
     settings.verbose = level > MAX_VERBOSITY_LEVEL ? MAX_VERBOSITY_LEVEL : level;
-    out_string(c, "DONE");
+    out_string(c, "OK");
     return;
 }
 
@@ -1786,8 +1788,6 @@
  *   TRANSMIT_HARD_ERROR Can't write (c->state is set to conn_closing)
  */
 static int transmit(conn *c) {
-    int res;
-
     assert(c != NULL);
 
     if (c->msgcurr < c->msgused &&
@@ -1796,7 +1796,9 @@
         c->msgcurr++;
     }
     if (c->msgcurr < c->msgused) {
+        ssize_t res;
         struct msghdr *m = &c->msglist[c->msgcurr];
+
         res = sendmsg(c->sfd, m, 0);
         if (res > 0) {
             STATS_LOCK();
@@ -1853,6 +1855,7 @@
     assert(c != NULL);
 
     while (!stop) {
+
         switch(c->state) {
         case conn_listening:
             addrlen = sizeof(addr);
@@ -2191,7 +2194,7 @@
     return sfd;
 }
 
-static int server_socket_unix(char *path) {
+static int server_socket_unix(const char *path) {
     int sfd;
     struct linger ling = {0, 0};
     struct sockaddr_un addr;




More information about the memcached-commits mailing list