Changeset be05f9f62e0da14f7ee9e4be1482b2698b400ac4

Show
Ignore:
Timestamp:
01/26/09 00:34:35 (5 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1232930075 +0000
git-parent:

[c7df82abd064c1843945283eceffb7eb63a27dcd]

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

make http flush fail when things go south, refs #71

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/noit_http.c

    r2d89607 rbe05f9f  
    188188noit_http_request_finalize(noit_http_request *req, noit_boolean *err) { 
    189189  int start; 
    190   const char *mstr, *last_name
     190  const char *mstr, *last_name = NULL
    191191  struct bchain *b; 
    192192 
     
    725725    eventer_update(ctx->conn.e, mask); 
    726726  } 
    727   return noit_true; 
     727  /* If the write fails completely, the event will be closed, freed and NULL */ 
     728  return ctx->conn.e ? noit_true : noit_false; 
    728729} 
    729730noit_boolean 
  • src/stratcon_realtime_http.c

    r2d89607 rbe05f9f  
    7777  int len; 
    7878 
     79#define BAIL_HTTP_WRITE do { \ 
     80  noitL(noit_error, "javascript emit failed: %s:%s:%d\n", \ 
     81        __FILE__, __FUNCTION__, __LINE__); \ 
     82  return -1; \ 
     83} while(0) 
     84 
    7985#define PROCESS_NEXT_FIELD(t,l) do { \ 
    8086  if(!*scp) goto bad_row; \ 
     
    99105  if(buff[0] == 'M') { 
    100106    snprintf(buffer, sizeof(buffer), "<script>window.parent.plot_iframe_data('"); 
    101     if(noit_http_response_append(ctx, buffer, strlen(buffer)) == noit_false) return -1
     107    if(noit_http_response_append(ctx, buffer, strlen(buffer)) == noit_false) BAIL_HTTP_WRITE
    102108 
    103109    /* Time */ 
    104110    PROCESS_NEXT_FIELD(token,len); 
    105     if(noit_http_response_append(ctx, token, len) == noit_false) return -1
     111    if(noit_http_response_append(ctx, token, len) == noit_false) BAIL_HTTP_WRITE
    106112 
    107113    snprintf(buffer, sizeof(buffer), "', '"); 
    108     if(noit_http_response_append(ctx, buffer, strlen(buffer)) == noit_false) return -1
     114    if(noit_http_response_append(ctx, buffer, strlen(buffer)) == noit_false) BAIL_HTTP_WRITE
    109115 
    110116    /* UUID */ 
    111117    PROCESS_NEXT_FIELD(token,len); 
    112     if(noit_http_response_append(ctx, token, len) == noit_false) return -1
     118    if(noit_http_response_append(ctx, token, len) == noit_false) BAIL_HTTP_WRITE
    113119 
    114120    snprintf(buffer, sizeof(buffer), "', '"); 
    115     if(noit_http_response_append(ctx, buffer, strlen(buffer)) == noit_false) return -1
     121    if(noit_http_response_append(ctx, buffer, strlen(buffer)) == noit_false) BAIL_HTTP_WRITE
    116122 
    117123    /* name */ 
    118124    PROCESS_NEXT_FIELD(token,len); 
    119     if(noit_http_response_append(ctx, token, len) == noit_false) return -1
     125    if(noit_http_response_append(ctx, token, len) == noit_false) BAIL_HTTP_WRITE
    120126 
    121127    snprintf(buffer, sizeof(buffer), "', '"); 
    122     if(noit_http_response_append(ctx, buffer, strlen(buffer)) == noit_false) return -1
     128    if(noit_http_response_append(ctx, buffer, strlen(buffer)) == noit_false) BAIL_HTTP_WRITE
    123129 
    124130    PROCESS_NEXT_FIELD(token,len); /* skip type */ 
    125131    PROCESS_LAST_FIELD(token,len); /* value */ 
    126     if(noit_http_response_append(ctx, token, len) == noit_false) return -1
     132    if(noit_http_response_append(ctx, token, len) == noit_false) BAIL_HTTP_WRITE
    127133 
    128134    snprintf(buffer, sizeof(buffer), "');</script>\n"); 
    129     if(noit_http_response_append(ctx, buffer, strlen(buffer)) == noit_false) return -1
    130  
    131     if(noit_http_response_flush(ctx, noit_false) == noit_false) return -1
     135    if(noit_http_response_append(ctx, buffer, strlen(buffer)) == noit_false) BAIL_HTTP_WRITE
     136 
     137    if(noit_http_response_flush(ctx, noit_false) == noit_false) BAIL_HTTP_WRITE
    132138  } 
    133139 
     
    135141 
    136142 bad_row: 
    137   return -1
     143  BAIL_HTTP_WRITE
    138144  if(0) { 
    139145    noit_http_response_end(ctx);