Changeset bd54e8d25218b7d09076b7b541c108a2a68fe992

Show
Ignore:
Timestamp:
02/27/08 04:24:23 (7 years ago)
Author:
Theo Schlossnagle <jesus@omniti.com>
git-committer:
Theo Schlossnagle <jesus@omniti.com> 1204086263 +0000
git-parent:

[04242928f5428460d4da69245f0f005b56051fc2]

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

basic log streamer, need a client to further test it.

Files:

Legend:

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

    r0424292 rbd54e8d  
    9393        goto alldone; 
    9494      } 
     95      /* Read our jlog_id accounting for possibly short reads */ 
     96      bytes_read = 0; 
     97      while(bytes_read < sizeof(jlog_id)) { 
     98        int len; 
     99        if((len = e->opset->read(e->fd, inbuff + bytes_read, 
     100                                 sizeof(jlog_id) - bytes_read, 
     101                                 &mask, e)) <= 0) 
     102          goto alldone; 
     103        bytes_read += len; 
     104      } 
     105      memcpy(&client_chkpt, inbuff, sizeof(jlog_id)); 
     106      /* Fix the endian */ 
     107      client_chkpt.log = ntohl(client_chkpt.log); 
     108      client_chkpt.marker = ntohl(client_chkpt.marker); 
     109   
     110      if(memcmp(&jcl->chkpt, &client_chkpt, sizeof(jlog_id))) { 
     111        noitL(noit_error, 
     112              "client %s submitted invalid checkpoint %u:%u expected %u:%u\n", 
     113              ac->remote_cn, client_chkpt.log, client_chkpt.marker, 
     114              jcl->chkpt.log, jcl->chkpt.marker); 
     115        goto alldone; 
     116      } 
     117      jlog_ctx_read_checkpoint(jcl->jlog, &jcl->chkpt); 
    95118    } 
    96     /* Read our jlog_id accounting for possibly short reads */ 
    97     bytes_read = 0; 
    98     while(bytes_read < sizeof(jlog_id)) { 
    99       int len; 
    100       if((len = e->opset->read(e->fd, inbuff + bytes_read, 
    101                                sizeof(jlog_id) - bytes_read, 
    102                                &mask, e)) <= 0) 
    103         goto alldone; 
    104       bytes_read += len; 
    105     } 
    106     memcpy(&client_chkpt, inbuff, sizeof(jlog_id)); 
    107     /* Fix the endian */ 
    108     client_chkpt.log = ntohl(client_chkpt.log); 
    109     client_chkpt.marker = ntohl(client_chkpt.marker); 
    110  
    111     if(memcmp(&jcl->chkpt, &client_chkpt, sizeof(jlog_id))) { 
    112       noitL(noit_error, 
    113             "client %s submitted invalid checkpoint %u:%u expected %u:%u\n", 
    114             ac->remote_cn, client_chkpt.log, client_chkpt.marker, 
    115             jcl->chkpt.log, jcl->chkpt.marker); 
    116       goto alldone; 
    117     } 
    118     jlog_ctx_read_checkpoint(jcl->jlog, &jcl->chkpt); 
    119119    sleep(5); 
    120120  }