Esempio n. 1
0
static void msend_req_send_stat_delete_report(mfile *m)
{
  mhost   *t;
  uint8_t *r;
  char *dryrun = "";

  if(m->dryrun){
    dryrun = "(dryrun) ";
    if(ack_check(m, MAKUO_RECVSTATE_DELETEOK) == 1){
      if(m->comm){
        if(m->comm->loglevel == 0){
          cprintf(0, m->comm, "%s[delete:%s]\n", dryrun, m->fn);
        }
      }
    }
  }

  for(t=members;t;t=t->next){
    if(m->sendto){
      if(t != member_get(&(m->addr.sin_addr))){
        continue;
      }
    }
    if((r = get_hoststate(t, m))){
      if(*r == MAKUO_RECVSTATE_DELETEOK){
        cprintf(1, m->comm, "%sdelete %s:%s\n", dryrun, t->hostname, m->fn);
        lprintf(1, "%sdelete %s:%s\n", dryrun, t->hostname, m->fn);
      }
    }
  }
}
Esempio n. 2
0
void recv_timeout(mfile *m)
{
  mhost   *t;
  uint8_t *r;
  if(!m){
    return;
  }
  do{
    for(t=members;t;t=t->next){
      r = get_hoststate(t, m);
      if(*r == MAKUO_RECVSTATE_NONE){
        member_del_message(1, t, "receive time out");
        member_del(t);
        break;
      }
    }
  }while(t); 
  m->retrycnt = MAKUO_SEND_RETRYCNT;
}
Esempio n. 3
0
/* retry */
static int msend_retry(mfile *m)
{
  uint8_t *r;
  mhost   *t;

  if(!m){
    return(-1);
  }
  if(!m->sendwait){
    m->retrycnt = MAKUO_SEND_RETRYCNT;
    return(0);
  }
  if(moption.loglevel > 1){
    mprintf(2, __func__, m); 
    for(t=members;t;t=t->next){
      r = get_hoststate(t, m);
      if(!r){
        lprintf(0, "[error] %s: can't alloc state area %s\n", __func__, t->hostname);
        continue;
      }
      if(m->sendto){
        if(!memcmp(&(m->addr.sin_addr), &(t->ad), sizeof(t->ad))){
          if(*r == MAKUO_RECVSTATE_NONE){
            lprintf(2, "%s:   %s %s(%s)\n", __func__, strrstate(*r), inet_ntoa(t->ad), t->hostname);
          }
        }
      }else{
        switch(moption.loglevel){
          case 2:
            if(*r == MAKUO_RECVSTATE_NONE){
              lprintf(2, "%s:   %s %s(%s)\n", __func__, strrstate(*r), inet_ntoa(t->ad), t->hostname);
            }
            break;
          default:
            lprintf(3, "%s:   %s %s(%s)\n", __func__, strrstate(*r), inet_ntoa(t->ad), t->hostname);
            break;
        }
      }
    }
  }
  m->retrycnt--;
  return(0);
}
Esempio n. 4
0
static void msend_req_send_stat_update_report(mfile *m)
{
  uint8_t *r;
  mhost   *t;
  char *dryrun = "";

  if(m->dryrun){
    dryrun = "(dryrun) ";
    if(ack_check(m, MAKUO_RECVSTATE_UPDATE) == 1){
      if(m->comm){
        if(m->comm->loglevel == 0){
          cprintf(0, m->comm, "%s[update:%s]\n", dryrun, m->fn);
        }
      }
    }
  }

  for(t=members;t;t=t->next){
    if(m->sendto){
      if(t != member_get(&(m->addr.sin_addr))){
        continue;
      }
    }
    if((r = get_hoststate(t, m))){
      if(*r == MAKUO_RECVSTATE_UPDATE){
        cprintf(1, m->comm, "%supdate %s:%s\r\n", dryrun, t->hostname, m->fn);
        lprintf(1, "%supdate %s:%s\n", dryrun, t->hostname, m->fn);
      }
      if(*r == MAKUO_RECVSTATE_SKIP){
        cprintf(2, m->comm, "%sskip   %s:%s\r\n", dryrun, t->hostname, m->fn);
        lprintf(5, "%sskip   %s:%s\n", dryrun, t->hostname, m->fn);
      }
      if(*r == MAKUO_RECVSTATE_READONLY){
        cprintf(3, m->comm, "%sskipro %s:%s\r\n", dryrun, t->hostname, m->fn);
        lprintf(6, "%sskipro %s:%s\n", dryrun, t->hostname, m->fn);
      }
    }
  }
}