Changeset 729

Show
Ignore:
Timestamp:
02/29/08 19:43:21 (9 months ago)
Author:
dsallings
Message:

Minor refactoring of server_socket.

Build the linked list out backwards so this command may be executed
more than once. This also reduces the code a bit.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/server/memcached.c

    r728 r729  
    23912391} 
    23922392 
    2393  
    23942393static int server_socket(const int port, const bool is_udp) { 
    23952394    int sfd; 
     
    24322431    } 
    24332432 
    2434     conn *conn_ptr = NULL; 
    24352433    for (next= ai; next; next= next->ai_next) { 
    24362434        conn *listen_conn_add; 
     
    24842482        } 
    24852483 
    2486         if (listen_conn == NULL) { 
    2487             conn_ptr = listen_conn = listen_conn_add; 
    2488         } else { 
    2489             conn_ptr->next= listen_conn_add; 
    2490         } 
     2484        listen_conn_add->next = listen_conn; 
     2485        listen_conn = listen_conn_add; 
    24912486      } 
    24922487    } 
     
    24942489    freeaddrinfo(ai); 
    24952490 
    2496     if (success == 0) 
    2497         return 1; 
    2498  
    2499     return 0; 
     2491    /* Return zero iff we detected no errors in starting up connections */ 
     2492    return success == 0; 
    25002493} 
    25012494