Changeset 754

Show
Ignore:
Timestamp:
03/18/08 17:21:05 (6 months ago)
Author:
dsallings
Message:

Ensure all connection states are expressed as enums.

Function declarations should have parameter names.

Files:

Legend:

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

    r753 r754  
    7070static int try_read_network(conn *c); 
    7171static int try_read_udp(conn *c); 
    72 static void conn_set_state(conn *, int); 
     72static void conn_set_state(conn *c, enum conn_states state); 
    7373 
    7474/* stats */ 
     
    314314} 
    315315 
    316 conn *conn_new(const int sfd, const int init_state, const int event_flags, 
     316conn *conn_new(const int sfd, enum conn_states init_state, 
     317                const int event_flags, 
    317318                const int read_buffer_size, enum protocol prot, 
    318319                struct event_base *base) { 
     
    513514} 
    514515 
    515 static int get_init_state(conn *c) { 
     516static enum conn_states get_init_state(conn *c) { 
    516517    int rv=0; 
    517518    assert(c != NULL); 
     
    601602 * happen here. 
    602603 */ 
    603 static void conn_set_state(conn *c, int state) { 
     604static void conn_set_state(conn *c, enum conn_states state) { 
    604605    assert(c != NULL); 
    605606 
     
    27262727    bool stop = false; 
    27272728    int sfd, flags = 1; 
    2728     int init_state; /* initial state for a new connection */ 
     2729    enum conn_states init_state; /* initial state for a new connection */ 
    27292730    socklen_t addrlen; 
    27302731    struct sockaddr_storage addr; 
  • branches/binary/server/memcached.h

    r752 r754  
    217217struct conn { 
    218218    int    sfd; 
    219     int    state; 
     219    enum conn_states  state; 
    220220    int    substate; 
    221221    struct event event; 
     
    315315char *do_add_delta(item *item, const bool incr, const int64_t delta, char *buf); 
    316316int do_store_item(item *item, int comm); 
    317 conn *conn_new(const int sfd, const int init_state, const int event_flags, const int read_buffer_size, enum protocol prot, struct event_base *base); 
     317conn *conn_new(const int sfd, const enum conn_states init_state, const int event_flags, const int read_buffer_size, enum protocol prot, struct event_base *base); 
    318318 
    319319 
     
    341341void thread_init(int nthreads, struct event_base *main_base); 
    342342int  dispatch_event_add(int thread, conn *c); 
    343 void dispatch_conn_new(int sfd, int init_state, int event_flags, int read_buffer_size, enum protocol prot); 
     343void dispatch_conn_new(int sfd, enum conn_states init_state, int event_flags, int read_buffer_size, enum protocol prot); 
    344344 
    345345/* Lock wrappers for cache functions that are called from main loop. */