Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
efe7328981
  1. 27
      basilisk/basilisk.c
  2. 2
      basilisk/basilisk.h
  3. 2
      basilisk/basilisk_CMD.c

27
basilisk/basilisk.c

@ -690,21 +690,22 @@ void basilisks_loop(void *arg)
}
}
//portable_mutex_unlock(&myinfo->allcoins_mutex);
}
if ( myinfo->RELAYID >= 0 )
{
struct basilisk_relay *rp; int32_t i,j,datalen=0; uint8_t data[1024];
for (i=0; i<myinfo->numrelays; i++)
if ( myinfo->RELAYID >= 0 )
{
rp = &myinfo->relays[i];
if ( rp->addr != 0 && rp->addr->usock >= 0 )
struct iguana_peer *addr; struct basilisk_relay *rp; int32_t i,j,datalen=0; uint8_t data[1024];
for (i=0; i<myinfo->numrelays; i++)
{
data[datalen++] = myinfo->numrelays;
for (j=0; j<myinfo->numrelays; j++)
data[datalen++] = myinfo->relays[j].status;
if ( iguana_queue_send(rp->addr,0,&data[sizeof(struct iguana_msghdr)],"SuperNET",datalen) != datalen )
printf("error sending %d to (%s)\n",datalen,rp->addr->ipaddr);
else printf("sent %d to (%s)\n",datalen,rp->addr->ipaddr);
rp = &myinfo->relays[i];
if ( (addr= iguana_peerfindipbits(btcd,rp->ipbits,1)) != 0 && addr->usock >= 0 )
{
data[datalen++] = myinfo->numrelays;
for (j=0; j<myinfo->numrelays; j++)
data[datalen++] = myinfo->relays[j].status;
if ( iguana_queue_send(addr,0,&data[sizeof(struct iguana_msghdr)],"SuperNET",datalen) != datalen )
printf("error sending %d to (%s)\n",datalen,addr->ipaddr);
else printf("sent %d to (%s)\n",datalen,addr->ipaddr);
flag++;
}
}
}
}

2
basilisk/basilisk.h

@ -47,7 +47,7 @@ struct basilisk_info
struct basilisk_relay
{
bits256 pubkey; uint32_t ipbits; struct iguana_peer *addr;
bits256 pubkey; uint32_t ipbits;
uint8_t status,pubkey33[33];
};

2
basilisk/basilisk_CMD.c

@ -62,7 +62,7 @@ char *basilisk_addrelay_info(struct supernet_info *myinfo,uint8_t *pubkey33,uint
printf("add relay[%d] <- %x\n",i,ipbits);
rp = &myinfo->relays[i];
rp->ipbits = ipbits;
rp->addr = basilisk_ensurerelay(myinfo,btcd,rp->ipbits);
basilisk_ensurerelay(myinfo,btcd,rp->ipbits);
if ( myinfo->numrelays < sizeof(myinfo->relays)/sizeof(*myinfo->relays) )
myinfo->numrelays++;
for (i=0; i<myinfo->numrelays; i++)

Loading…
Cancel
Save