Changeset 657

Show
Ignore:
Timestamp:
09/08/08 22:01:49 (5 months ago)
Author:
smoku
Message:

Writing stream error to the wire before closing stream

Location:
trunk/sx
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/sx/error.c

    r156 r657  
    8484    /* stuff to write */ 
    8585    s->want_write = 1; 
     86 
     87        _sx_event(s, event_WANT_WRITE, NULL); 
    8688} 
    8789 
  • trunk/sx/io.c

    r620 r657  
    468468    /* close the stream if necessary */ 
    469469    if(s->state >= state_STREAM_SENT) { 
     470        _sx_debug(ZONE, "sending closing </stream:stream>"); 
    470471        jqueue_push(s->wbufq, _sx_buffer_new("</stream:stream>", 16, NULL, NULL), 0); 
    471472        s->want_write = 1; 
    472     } 
    473  
    474     _sx_state(s, state_CLOSING); 
     473        _sx_state(s, state_CLOSING); 
     474        _sx_event(s, event_WANT_WRITE, NULL); 
     475    } else 
     476        _sx_state(s, state_CLOSING); 
    475477} 
    476478 
  • trunk/sx/ssl.c

    r644 r657  
    103103        if(NAD_ENAME_L(nad, 0) == 8 && strncmp(NAD_ENAME(nad, 0), "starttls", 8) == 0) { 
    104104            nad_free(nad); 
    105      
     105 
    106106            /* can't go on if we've been here before */ 
    107107            if(s->ssf > 0) { 
     
    255255                _sx_close(s); 
    256256 
    257                 /* !!! drop queue */ 
    258  
    259257                return -1; 
    260258            } 
     
    272270    sx_error_t sxe; 
    273271 
    274     /* sanity */ 
     272    /* do not encrypt when error */ 
    275273    if(sc->last_state == SX_SSL_STATE_ERROR) 
    276         return -2; 
     274        return 1; 
    277275 
    278276    _sx_debug(ZONE, "in _sx_ssl_wio"); 
     
    485483    if(sc->last_state == SX_SSL_STATE_WANT_READ || sc->last_state == SX_SSL_STATE_NONE) 
    486484        s->want_read = 1; 
    487      
     485 
    488486    if(buf->len == 0) 
    489487        return 0; 
     
    655653 
    656654    free(sc); 
    657      
     655 
    658656    s->plugin_data[p->index] = NULL; 
    659657} 
     
    748746        return 1; 
    749747    } 
    750      
     748 
    751749    /* Load the CA chain, if configured */ 
    752750    if (cachain != NULL) {