Changeset 658

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

Fixed sending stream errors on wrapper errors

Location:
trunk/sx
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/sx/compress.c

    r656 r658  
    178178            _sx_event(s, event_ERROR, (void *) &sxe); 
    179179 
    180             _sx_error(s, stream_err_INTERNAL_SERVER_ERROR, "Error during compression"); 
    181             _sx_close(s); 
     180            sx_error(s, stream_err_INTERNAL_SERVER_ERROR, "Error during compression"); 
     181            sx_close(s); 
    182182 
    183183            return -2;  /* fatal */ 
     
    237237                _sx_event(s, event_ERROR, (void *) &sxe); 
    238238 
    239                 _sx_error(s, stream_err_INVALID_XML, "Error during decompression"); 
    240                 _sx_close(s); 
     239                sx_error(s, stream_err_INVALID_XML, "Error during decompression"); 
     240                sx_close(s); 
    241241 
    242242                return -2; 
  • trunk/sx/error.c

    r657 r658  
    8484    /* stuff to write */ 
    8585    s->want_write = 1; 
    86  
    87         _sx_event(s, event_WANT_WRITE, NULL); 
    8886} 
    8987 
  • 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 
  • trunk/sx/ssl.c

    r657 r658  
    252252                _sx_event(s, event_ERROR, (void *) &sxe); 
    253253 
    254                 _sx_error(s, stream_err_INTERNAL_SERVER_ERROR, errstring); 
    255                 _sx_close(s); 
     254                sx_error(s, stream_err_INTERNAL_SERVER_ERROR, errstring); 
     255                sx_close(s); 
     256 
     257                /* !!! drop queue */ 
    256258 
    257259                return -1; 
     
    331333                _sx_event(s, event_ERROR, (void *) &sxe); 
    332334 
    333                 _sx_error(s, stream_err_INTERNAL_SERVER_ERROR, errstring); 
    334                 _sx_close(s); 
     335                sx_error(s, stream_err_INTERNAL_SERVER_ERROR, errstring); 
     336                sx_close(s); 
    335337 
    336338                /* !!! drop queue */ 
     
    464466                _sx_event(s, event_ERROR, (void *) &sxe); 
    465467 
    466                 _sx_error(s, stream_err_INTERNAL_SERVER_ERROR, errstring); 
    467                 _sx_close(s); 
     468                sx_error(s, stream_err_INTERNAL_SERVER_ERROR, errstring); 
     469                sx_close(s); 
    468470 
    469471                /* !!! drop queue */