static #endif int champ_server_deal_with_rbuf_sig(struct asfd *asfd, const char *directory, struct scores *scores) { struct blk *blk; if(!(blk=blk_alloc())) return -1; blist_add_blk(asfd->blist, blk); if(!asfd->blist->blk_to_dedup) asfd->blist->blk_to_dedup=blk; if(blk_set_from_iobuf_sig(blk, asfd->rbuf)) return -1; //logp("Got fingerprint from %d: %lu - %lu\n", // asfd->fd, blk->index, blk->fingerprint); return deduplicate_maybe(asfd, blk, directory, scores); }
static int add_to_sig_list(struct slist *slist, struct iobuf *rbuf) { // Goes on slist->add_sigs_here struct blk *blk; struct protocol2 *protocol2; if(!(blk=blk_alloc())) return -1; blist_add_blk(slist->blist, blk); protocol2=slist->add_sigs_here->protocol2; if(!protocol2->bstart) protocol2->bstart=blk; if(!protocol2->bsighead) protocol2->bsighead=blk; if(blk_set_from_iobuf_sig(blk, rbuf)) return -1; // Need to send sigs to champ chooser, therefore need to point // to the oldest unsent one if nothing is pointed to yet. if(!slist->blist->blk_for_champ_chooser) slist->blist->blk_for_champ_chooser=blk; return 0; }