Changeset 658 for trunk/sx/io.c

Show
Ignore:
Timestamp:
09/08/08 23:12:09 (5 months ago)
Author:
smoku
Message:

Fixed sending stream errors on wrapper errors

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/sx/io.c

    r657 r658  
    126126                    _sx_state(s, state_CLOSING); 
    127127                } 
    128      
     128 
    129129                if(errstring != NULL) free(errstring); 
    130      
     130 
    131131                nad_free(nad); 
    132      
     132 
    133133                break; 
    134134            } 
    135      
     135 
    136136            /* run it by the plugins */ 
    137137            if(_sx_chain_nad_read(s, nad) == 0) 
    138138                return; 
    139      
     139 
    140140            /* now let the plugins process the completed nad */ 
    141141            plugin_error = 0; 
     
    150150                        } 
    151151                    } 
    152      
     152 
    153153            /* hand it to the app */ 
    154154            if ((plugin_error == 0) && (s->state < state_CLOSING)) 
     
    159159    if(s->fail) { 
    160160        _sx_close(s); 
    161          
     161 
    162162        return; 
    163163    } 
     
    209209        _sx_buffer_free(in); 
    210210        _sx_state(s, state_CLOSING); 
    211      
     211 
    212212    } else { 
    213213        _sx_debug(ZONE, "passed %d read bytes", in->len); 
     
    316316    sx_buf_t out; 
    317317    int ret, written; 
    318      
     318 
    319319    assert((int) (s != NULL)); 
    320320 
     
    346346    _sx_debug(ZONE, "handing app %d bytes to write", out->len); 
    347347    written = _sx_event(s, event_WRITE, (void *) out); 
    348      
     348 
    349349    if(written < 0) { 
    350350        /* bail if something went wrong */ 
     
    468468    /* close the stream if necessary */ 
    469469    if(s->state >= state_STREAM_SENT) { 
    470         _sx_debug(ZONE, "sending closing </stream:stream>"); 
    471470        jqueue_push(s->wbufq, _sx_buffer_new("</stream:stream>", 16, NULL, NULL), 0); 
    472471        s->want_write = 1; 
    473         _sx_state(s, state_CLOSING); 
    474         _sx_event(s, event_WANT_WRITE, NULL); 
    475     } else 
    476         _sx_state(s, state_CLOSING); 
     472    } 
     473 
     474    _sx_state(s, state_CLOSING); 
    477475} 
    478476