Changeset fb5f8f9daa6e4df8e9acc3c11501205c21866b72

Show
Ignore:
Timestamp:
07/02/08 04:40:56 (6 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1214973656 +0000
git-parent:

[cdd3b47db7b8a6f873d7dcf7bf1b1329513c0cb2]

git-author:
Theo Schlossnagle <jesus@omniti.com> 1214973656 +0000
Message:

fix up SSL layer to handle termination and make the jlog rcpt side completely reset on error, refs #41

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/eventer/eventer_SSL_fd_opset.c

    r2962688 rfb5f8f9  
    319319  switch(op) { 
    320320    case SSL_OP_READ: 
    321       if((rv = SSL_read(ctx->ssl, buffer, len)) >= 0) return rv; 
     321      if((rv = SSL_read(ctx->ssl, buffer, len)) > 0) return rv; 
    322322      break; 
    323323    case SSL_OP_WRITE: 
    324       if((rv = SSL_write(ctx->ssl, buffer, len)) >= 0) return rv; 
     324      if((rv = SSL_write(ctx->ssl, buffer, len)) > 0) return rv; 
    325325      break; 
    326326 
     
    346346 
    347347  switch(sslerror = SSL_get_error(ctx->ssl, rv)) { 
     348    case SSL_ERROR_NONE: 
     349      return 0; 
    348350    case SSL_ERROR_WANT_READ: 
    349351    case SSL_ERROR_WANT_WRITE: 
     
    353355      break; 
    354356    default: 
     357      noitL(noit_error, "SSL rw error: %d\n", sslerror); 
    355358      eventer_ssl_error(); 
    356359      errno = EIO; 
  • src/stratcon_jlog_streamer.c

    rc4546c7 rfb5f8f9  
    141141      return -1; 
    142142    } 
    143     if(len == 0) return ctx->bytes_read; 
     143    /* if we get 0 inside SSL, and there was a real error, we 
     144     * will actually get a -1 here. 
     145     * if(len == 0) return ctx->bytes_read; 
     146     */ 
    144147    ctx->bytes_read += len; 
    145148  } 
     
    162165  if(len < 0) { \ 
    163166    if(errno == EAGAIN) return mask | EVENTER_EXCEPTION; \ 
     167    noitL(noit_error, "SSL read error: %s\n", strerror(errno)); \ 
    164168    goto socket_error; \ 
    165169  } \ 
     
    182186  if(mask & EVENTER_EXCEPTION || ctx->wants_shutdown) { 
    183187 socket_error: 
     188    ctx->state = WANT_COUNT; 
     189    ctx->count = 0; 
     190    ctx->bytes_read = 0; 
     191    ctx->bytes_expected = 0; 
     192    if(ctx->buffer) free(ctx->buffer); 
     193    ctx->buffer = NULL; 
    184194    jlog_streamer_schedule_reattempt(ctx, now); 
    185195    eventer_remove_fd(e->fd);