Changeset 498

Show
Ignore:
Timestamp:
04/12/07 17:35:06 (2 years ago)
Author:
plindner
Message:

more fixes from Paolo

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/server/ChangeLog

    r496 r498  
    22 
    33        * Allow changes to the verbosity level of the server with a new 
    4           "verbosity" command.  Patch contributed by Paolo Borelli 
    5         <paolo.borelli@gmail.com>. 
     4          "verbosity" command and some compiler cleanups.  
     5          Patch contributed by Paolo Borelli <paolo.borelli@gmail.com>. 
    66 
    772007-04-08  Paul Lindner  <lindner@inuus.com> 
  • trunk/server/doc/protocol.txt

    r496 r498  
    400400server. 
    401401 
    402 "verbosity" is a command with one argument, the verbosity level: 
    403  
    404 verbosity 2\r\n 
    405  
    406 In response, the server sends 
    407  
    408 "DONE" 
    409  
     402"verbosity" is a command with a numeric argument. It always                                                   
     403succeeds, and the server sends "OK\r\n" in response. Its effect is to                                         
     404set the verbosity level of the logging output.                                                                
    410405 
    411406"quit" is a command with no arguments: 
  • trunk/server/memcached.c

    r496 r498  
    468468 
    469469    if (c->rsize > READ_BUFFER_HIGHWAT && c->rbytes < DATA_BUFFER_SIZE) { 
     470        char *newbuf; 
     471 
    470472        if (c->rcurr != c->rbuf) 
    471473            memmove(c->rbuf, c->rcurr, (size_t)c->rbytes); 
    472474 
    473         char *newbuf = (char *)realloc((void *)c->rbuf, DATA_BUFFER_SIZE); 
     475        newbuf = (char *)realloc((void *)c->rbuf, DATA_BUFFER_SIZE); 
    474476 
    475477        if (newbuf) { 
     
    654656 
    655657static void out_string(conn *c, const char *str) { 
    656     int len; 
     658    size_t len; 
    657659 
    658660    assert(c != NULL); 
     
    668670    } 
    669671 
    670     strcpy(c->wbuf, str); 
    671     strcpy(c->wbuf + len, "\r\n"); 
     672    memcpy(c->wbuf, str, len); 
     673    memcpy(c->wbuf + len, "\r\n", 2); 
    672674    c->wbytes = len + 2; 
    673675    c->wcurr = c->wbuf; 
     
    13301332    level = strtoul(tokens[1].value, NULL, 10); 
    13311333    settings.verbose = level > MAX_VERBOSITY_LEVEL ? MAX_VERBOSITY_LEVEL : level; 
    1332     out_string(c, "DONE"); 
     1334    out_string(c, "OK"); 
    13331335    return; 
    13341336} 
     
    16901692 */ 
    16911693static int transmit(conn *c) { 
    1692     int res; 
    1693  
    16941694    assert(c != NULL); 
    16951695 
     
    17001700    } 
    17011701    if (c->msgcurr < c->msgused) { 
     1702        ssize_t res; 
    17021703        struct msghdr *m = &c->msglist[c->msgcurr]; 
     1704 
    17031705        res = sendmsg(c->sfd, m, 0); 
    17041706        if (res > 0) { 
     
    17551757 
    17561758    while (!stop) { 
     1759 
    17571760        switch(c->state) { 
    17581761        case conn_listening: 
     
    17771780                break; 
    17781781            } 
    1779             conn *newc = conn_new(sfd, conn_read, EV_READ | EV_PERSIST, 
    1780                             DATA_BUFFER_SIZE, false); 
    1781             if (!newc) { 
     1782            if (conn_new(sfd, conn_read, EV_READ | EV_PERSIST, 
     1783                            DATA_BUFFER_SIZE, false) == NULL) { 
    17821784                if (settings.verbose > 0) 
    17831785                    fprintf(stderr, "couldn't create new connection\n"); 
     
    20962098} 
    20972099 
    2098 static int server_socket_unix(char *path) { 
     2100static int server_socket_unix(const char *path) { 
    20992101    int sfd; 
    21002102    struct linger ling = {0, 0};