END_TEST START_TEST(test_cstat_load_data_from_disk) { struct cstat *clist=NULL; struct conf **globalcs; struct conf **cconfs; clist=test_cstat_remove_setup(&globalcs, cnames1234); fail_unless((cconfs=confs_alloc())!=NULL); cstat_load_data_from_disk(&clist, globalcs, cconfs); confs_free(&cconfs); test_cstat_remove_teardown(&globalcs, &clist); }
int status_server(struct async *as, struct conf **confs) { int ret=-1; int gotdata=0; struct asfd *asfd; struct cstat *clist=NULL; struct asfd *cfd=as->asfd; // Client. struct conf **cconfs=NULL; if(!(cconfs=confs_alloc())) goto end; while(1) { // Take the opportunity to get data from the disk if nothing // was read from the fds. if(gotdata) gotdata=0; else if(cstat_load_data_from_disk(&clist, confs, cconfs)) goto end; if(as->read_write(as)) { logp("Exiting main status server loop\n"); break; } for(asfd=as->asfd; asfd; asfd=asfd->next) while(asfd->rbuf->buf) { gotdata=1; if(parse_data(asfd, clist, cfd, confs) || asfd->parse_readbuf(asfd)) goto end; iobuf_free_content(asfd->rbuf); } } ret=0; end: // FIX THIS: should free clist; return ret; }