Browse Source

test

release/v0.1
jl777 8 years ago
parent
commit
0c592e86af
  1. 8
      basilisk/basilisk.c
  2. 7
      basilisk/basilisk_ping.c

8
basilisk/basilisk.c

@ -769,11 +769,6 @@ void basilisk_requests_poll(struct supernet_info *myinfo)
}
}
void basilisk_specialrelay(struct supernet_info *myinfo)
{
}
void basilisks_loop(void *arg)
{
struct iguana_info *virt,*tmpcoin,*coin,*btcd; struct basilisk_message *msg,*tmpmsg; struct basilisk_item *tmp,*pending; uint32_t now; int32_t iter,maxmillis,flag=0; struct supernet_info *myinfo = arg;
@ -806,10 +801,7 @@ void basilisks_loop(void *arg)
//portable_mutex_unlock(&myinfo->allcoins_mutex);
if ( (rand() % 10) == 0 && myinfo->RELAYID >= 0 )
{
if ( myinfo->RELAYID >= 0 )
basilisk_specialrelay(myinfo);
basilisk_ping_send(myinfo,btcd);
printf("my RELAYID.%d\n",myinfo->RELAYID);
}
}
HASH_ITER(hh,myinfo->allcoins,coin,tmpcoin)

7
basilisk/basilisk_ping.c

@ -201,7 +201,9 @@ int32_t basilisk_ping_gen(struct supernet_info *myinfo,uint8_t *data,int32_t max
void basilisk_ping_send(struct supernet_info *myinfo,struct iguana_info *btcd)
{
struct iguana_peer *addr; struct basilisk_relay *rp; int32_t i,datalen=0;
struct iguana_peer *addr; char ipaddr[64]; struct basilisk_relay *rp; int32_t i,datalen=0;
if ( btcd == 0 )
return;
if ( myinfo->pingbuf == 0 )
myinfo->pingbuf = malloc(IGUANA_MAXPACKETSIZE);
datalen = basilisk_ping_gen(myinfo,&myinfo->pingbuf[sizeof(struct iguana_msghdr)],IGUANA_MAXPACKETSIZE-sizeof(struct iguana_msghdr));
@ -209,6 +211,7 @@ void basilisk_ping_send(struct supernet_info *myinfo,struct iguana_info *btcd)
{
rp = &myinfo->relays[i];
addr = 0;
expand_ipbits(ipaddr,rp->ipbits);
if ( rp->ipbits == myinfo->myaddr.myipbits )
basilisk_ping_process(myinfo,0,myinfo->myaddr.myipbits,&myinfo->pingbuf[sizeof(struct iguana_msghdr)],datalen);
else if ( (addr= iguana_peerfindipbits(btcd,rp->ipbits,1)) != 0 && addr->usock >= 0 )
@ -217,6 +220,8 @@ void basilisk_ping_send(struct supernet_info *myinfo,struct iguana_info *btcd)
printf("error sending %d to (%s)\n",datalen,addr->ipaddr);
else printf("(%s) ",addr->ipaddr);
}
else iguana_launchpeer(btcd,ipaddr);
}
printf("my RELAYID.%d\n",myinfo->RELAYID);
}

Loading…
Cancel
Save