Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
1702903b16
  1. 8
      basilisk/basilisk_CMD.c

8
basilisk/basilisk_CMD.c

@ -39,14 +39,14 @@ struct iguana_peer *basilisk_ensurerelay(struct supernet_info *myinfo,struct igu
return(addr); return(addr);
} }
static int _decreasing_ipbits(const void *a,const void *b) static int _increasing_ipbits(const void *a,const void *b)
{ {
#define uint32_a (*(struct basilisk_relay *)a).ipbits #define uint32_a (*(struct basilisk_relay *)a).ipbits
#define uint32_b (*(struct basilisk_relay *)b).ipbits #define uint32_b (*(struct basilisk_relay *)b).ipbits
if ( uint32_b > uint32_a ) if ( uint32_b > uint32_a )
return(1);
else if ( uint32_b < uint32_a )
return(-1); return(-1);
else if ( uint32_b < uint32_a )
return(1);
return(0); return(0);
#undef uint32_a #undef uint32_a
#undef uint32_b #undef uint32_b
@ -101,7 +101,7 @@ char *basilisk_addrelay_info(struct supernet_info *myinfo,uint8_t *pubkey33,uint
basilisk_ensurerelay(myinfo,iguana_coinfind("BTCD"),rp->ipbits); basilisk_ensurerelay(myinfo,iguana_coinfind("BTCD"),rp->ipbits);
if ( myinfo->numrelays < sizeof(myinfo->relays)/sizeof(*myinfo->relays) ) if ( myinfo->numrelays < sizeof(myinfo->relays)/sizeof(*myinfo->relays) )
myinfo->numrelays++; myinfo->numrelays++;
qsort(myinfo->relays,myinfo->numrelays,sizeof(myinfo->relays[0]),_decreasing_ipbits); qsort(myinfo->relays,myinfo->numrelays,sizeof(myinfo->relays[0]),_increasing_ipbits);
for (i=0; i<myinfo->numrelays; i++) for (i=0; i<myinfo->numrelays; i++)
myinfo->relays[i].relayid = i; myinfo->relays[i].relayid = i;
basilisk_setmyid(myinfo); basilisk_setmyid(myinfo);

Loading…
Cancel
Save