Changeset 1691

Show
Ignore:
Timestamp:
02/22/2007 04:54:27 PM (1 year ago)
Author:
jan
Message:

fixed race-condition with the thread network backends

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/mod_proxy_core.c

    r1683 r1691  
    999999        proxy_connection *proxy_con = sess->proxy_con; 
    10001000        connection  *con  = sess->remote_con; 
     1001        int call_append = 1; 
    10011002 
    10021003        if (revents & FDEVENT_IN) { 
     
    10191020 
    10201021        if (revents & FDEVENT_OUT) { 
     1022                fdevent_event_add(srv->ev, proxy_con->sock, FDEVENT_IN); 
     1023 
    10211024                switch (srv->network_backend_write(srv, con, proxy_con->sock, proxy_con->send)) { 
    10221025                case NETWORK_STATUS_SUCCESS: 
     1026                        break; 
     1027                case NETWORK_STATUS_WAIT_FOR_AIO_EVENT: 
     1028                        call_append = 0; /* let the joblist-queue-handler call the connection again */ 
     1029                        break; 
    10231030                case NETWORK_STATUS_WAIT_FOR_EVENT: 
    1024                 case NETWORK_STATUS_WAIT_FOR_AIO_EVENT: 
     1031                       fdevent_event_add(srv->ev, proxy_con->sock, FDEVENT_IN | FDEVENT_OUT); 
    10251032                        break; 
    10261033                case NETWORK_STATUS_CONNECTION_CLOSE: 
     
    10491056        if (sess->is_closed) { 
    10501057                fdevent_event_del(srv->ev, sess->proxy_con->sock); 
    1051         } else { 
    1052                 /* update the fd events. */ 
    1053                 proxy_connection_enable_events(srv, proxy_con); 
    1054         } 
    1055  
    1056         /* let the proxy_state_engine() handle the data read/written. */ 
    1057         joblist_append(srv, con); 
     1058        } 
     1059 
     1060        /** 
     1061         * on NETWORK_STATUS_WAIT_FOR_AIO_EVENT we are no allowed to call the state-engine  
     1062         * the connection has to sleep until our disk-read is finished  
     1063         * 
     1064         * the joblist_append() will be called by the joblist_append_queue_handler in server.c 
     1065         */ 
     1066        if (call_append) joblist_append(srv, con); 
    10581067 
    10591068        return HANDLER_GO_ON;