Revision 41012841

View differences:

include/peerset.h
17 17
*/
18 18
typedef struct peerset PeerSet;
19 19

  
20
void peerset_destroy(struct peerset **h);
21

  
22
#define peerset_for_each(pset,p,i) \
23
		for(i=0,p= peerset_size(pset) > 0 ? ((const struct peer*)peerset_get_peers(pset)[0]) : NULL; i<peerset_size(pset);i++,p=((const struct peer*)peerset_get_peers(pset)[i]))
24

  
20 25
 /**
21 26
  * @brief Allocate a  peer set.
22 27
  * 
src/PeerSet/peerset_ops.c
88 88
  return p;
89 89
}
90 90

  
91
void peerset_destroy(struct peerset **h)
92
{
93
	peerset_clear(*h,0);
94
	free(*h);
95
	*h = NULL;
96
}
97

  
91 98
int peerset_push_peer(struct peerset *h,const  struct peer *e)
92 99
{
93 100
  int pos;
src/Scheduler/sched.c
215 215
  schedPeerID filtered[filtered_len];
216 216

  
217 217
  filterPeers2(peers, peers_len, chunks,chunks_len, filtered, &filtered_len, filter);
218
	fprintf(stderr,"[DEBUG] Filtered peers for offer: %d\n",filtered_len);
218
	//fprintf(stderr,"[DEBUG] Filtered peers for offer: %d\n",filtered_len);
219 219

  
220 220
  selectPeers(ordering, filtered, filtered_len, evaluate, selected, selected_len);
221 221
}
src/net_helper-udp.c
281 281
{
282 282
  int n;
283 283

  
284
	if (s)
284
	if (s && node_ip(s, addr, len)>=0)
285 285
	{
286
		if (node_ip(s, addr, len) < 0) {
287
			return -1;
288
		}
289 286
		n = snprintf(addr + strlen(addr), len - strlen(addr) - 1, ":%d", node_port(s));
290 287
	} else
291 288
		n = snprintf(addr, len , "None");
......
362 359

  
363 360
int node_ip(const struct nodeID *s, char *ip, int len)
364 361
{
362
	int res = 0;
365 363
  switch (s->addr.ss_family)
366 364
  {
367 365
    case AF_INET:
......
371 369
      inet_ntop(s->addr.ss_family, &((const struct sockaddr_in6 *)&s->addr)->sin6_addr, ip, len);
372 370
      break;
373 371
    default:
372
			res = -1;
374 373
      break;
375 374
  }
376 375
  if (!ip) {
377 376
	  perror("inet_ntop");
378
	  return -1;
377
		res = -1;
379 378
  }
380
  return 1;
379
  return res;
381 380
}
382 381

  
383 382
int node_port(const struct nodeID *s)

Also available in: Unified diff