Revision 56d5986f src/streaming.c

View differences:

src/streaming.c
54 54
#include "net_helpers.h"
55 55
#include "scheduling.h"
56 56
#include "transaction.h"
57
#include "peer_metadata.h"
57 58

  
58 59
#include "scheduler_la.h"
59 60

  
......
478 479
//	fprintf(stderr,"[DEBUG] Evaluating Peer %s, CB_SIZE: %d\n",node_addr_tr(n->id),p->cb_size); // DEBUG
479 480
//	print_chunkID_set(p->bmap);																					// DEBUG
480 481

  
481
  return _needs(stc, p->bmap, p->cb_size, cid);
482
  return _needs(stc, p->bmap, peer_cb_size(p), cid);
482 483
}
483 484

  
484 485
/**
......
525 526
{
526 527
	int min;
527 528

  
528
	if (p->cb_size == 0) // it does not have capacity
529
	if (peer_cb_size(p) == 0) // it does not have capacity
529 530
		return 0;
530 531
	if (chunkID_set_check(p->bmap,cid) < 0)  // not in bmap
531 532
	{
532
		if(p->cb_size > chunkID_set_size(p->bmap)) // it has room for chunks anyway
533
		if(peer_cb_size(p) > chunkID_set_size(p->bmap)) // it has room for chunks anyway
533 534
		{
534
			min = chunkID_set_get_earliest(p->bmap) - p->cb_size + chunkID_set_size(p->bmap);
535
			min = chunkID_set_get_earliest(p->bmap) - peer_cb_size(p) + chunkID_set_size(p->bmap);
535 536
			min = min < 0 ? 0 : min;
536 537
			if (cid >= min)
537 538
				return 1;
......
728 729
      int transid = transaction_create(stc->transactions, selectedpeers[i]->id);
729 730
      int max_deliver = offer_max_deliver(stc, selectedpeers[i]->id);
730 731
      struct chunkID_set *offer_cset = compose_offer_cset(stc, selectedpeers[i]);
731
      dprintf("\t sending offer(%d) to %s, cb_size: %d\n", transid, nodeid_static_str(selectedpeers[i]->id), selectedpeers[i]->cb_size);
732
      dprintf("\t sending offer(%d) to %s, cb_size: %d\n", transid, nodeid_static_str(selectedpeers[i]->id), peer_cb_size(selectedpeers[i]));
732 733
      offerChunks(selectedpeers[i]->id, offer_cset, max_deliver, transid++);
733 734
#ifdef LOG_SIGNAL
734 735
			log_signal(psinstance_nodeid(stc->ps),selectedpeers[i]->id,chunkID_set_size(offer_cset),transid,sig_offer,"SENT");

Also available in: Unified diff