Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
3ac19f3d59
  1. 5
      iguana/iguana_accept.c
  2. 3
      iguana/iguana_msg.c

5
iguana/iguana_accept.c

@ -213,7 +213,7 @@ int32_t iguana_peerinvrequest(struct iguana_info *coin,struct iguana_peer *addr,
int32_t iguana_peeraddrrequest(struct iguana_info *coin,struct iguana_peer *addr,uint8_t *space,int32_t spacesize) int32_t iguana_peeraddrrequest(struct iguana_info *coin,struct iguana_peer *addr,uint8_t *space,int32_t spacesize)
{ {
int32_t i,iter,n,max,sendlen; uint64_t x; struct iguana_msghdr H; struct iguana_msgaddress A; struct iguana_peer *tmpaddr; int32_t i,iter,n,max,sendlen; uint64_t x; struct iguana_msghdr H; struct iguana_peer *tmpaddr;
sendlen = 0; sendlen = 0;
max = (IGUANA_MINPEERS + IGUANA_MAXPEERS) / 2; max = (IGUANA_MINPEERS + IGUANA_MAXPEERS) / 2;
if ( max > coin->peers.numranked ) if ( max > coin->peers.numranked )
@ -224,8 +224,7 @@ int32_t iguana_peeraddrrequest(struct iguana_info *coin,struct iguana_peer *addr
{ {
for (i=n=0; i<max; i++) for (i=n=0; i<max; i++)
{ {
memset(&A,0,sizeof(A)); if ( (tmpaddr= coin->peers.ranked[i]) != 0 && ((iter == 0 && tmpaddr->supernet != 0) || (iter == 1 && tmpaddr->supernet == 0)) && tmpaddr->ipaddr[0] != 0 )
if ( (tmpaddr= coin->peers.ranked[i]) != 0 && ((iter == 0 && tmpaddr->supernet != 0) || (iter == 1 && tmpaddr->supernet == 0)) )
{ {
sendlen += iguana_rwaddr(1,&space[sizeof(H) + sendlen],&tmpaddr->A,(int32_t)tmpaddr->protover); sendlen += iguana_rwaddr(1,&space[sizeof(H) + sendlen],&tmpaddr->A,(int32_t)tmpaddr->protover);
x++; x++;

3
iguana/iguana_msg.c

@ -265,6 +265,7 @@ int32_t iguana_send_ping(struct iguana_info *coin,struct iguana_peer *addr)
addr->pingtime = (uint32_t)time(NULL); addr->pingtime = (uint32_t)time(NULL);
} }
printf("pingnonce.%llx from (%s)\n",(long long)nonce,addr->ipaddr); printf("pingnonce.%llx from (%s)\n",(long long)nonce,addr->ipaddr);
iguana_queue_send(coin,addr,0,serialized,"getaddr",0,0,0);
len = iguana_rwnum(1,&serialized[sizeof(struct iguana_msghdr)],sizeof(uint64_t),&nonce); len = iguana_rwnum(1,&serialized[sizeof(struct iguana_msghdr)],sizeof(uint64_t),&nonce);
if ( addr->supernet != 0 ) if ( addr->supernet != 0 )
iguana_send_supernet(coin,addr,SUPERNET_GETPEERSTR,0); iguana_send_supernet(coin,addr,SUPERNET_GETPEERSTR,0);
@ -540,7 +541,7 @@ int32_t iguana_msgparser(struct iguana_info *coin,struct iguana_peer *addr,struc
strcpy(addr->lastcommand,H->command); strcpy(addr->lastcommand,H->command);
} }
retval = 0; retval = 0;
printf("iguana_msgparser from (%s) parse.(%s) len.%d\n",addr->ipaddr,H->command,recvlen); //printf("iguana_msgparser from (%s) parse.(%s) len.%d\n",addr->ipaddr,H->command,recvlen);
if ( strncmp(H->command,"SuperNET",strlen("SuperNET")) == 0 ) if ( strncmp(H->command,"SuperNET",strlen("SuperNET")) == 0 )
{ {
addr->supernet = 1; addr->supernet = 1;

Loading…
Cancel
Save