|
|
@ -279,7 +279,7 @@ int32_t LP_sock_check(char *typestr,void *ctx,char *myipaddr,int32_t pubsock,int |
|
|
|
if ( (recvlen= nn_recv(sock,&ptr,NN_MSG,0)) > 0 ) |
|
|
|
{ |
|
|
|
methodstr[0] = 0; |
|
|
|
if ( 0 ) |
|
|
|
if ( 1 ) |
|
|
|
{ |
|
|
|
#ifdef FROM_JS |
|
|
|
printf("%s RECV.(%s)\n",typestr,(char *)ptr); |
|
|
@ -289,7 +289,7 @@ int32_t LP_sock_check(char *typestr,void *ctx,char *myipaddr,int32_t pubsock,int |
|
|
|
{ |
|
|
|
if ( (mstr= jstr(recvjson,"method")) != 0 )//&& strcmp(mstr,"uitem") == 0 && (cstr= jstr(recvjson,"coin")) != 0 && strcmp(cstr,"REVS") == 0 )
|
|
|
|
{ |
|
|
|
printf("%s RECV.(%s)\n",typestr,(char *)ptr); |
|
|
|
//printf("%s RECV.(%s)\n",typestr,(char *)ptr);
|
|
|
|
} |
|
|
|
safecopy(methodstr,jstr(recvjson,"method"),sizeof(methodstr)); |
|
|
|
free_json(recvjson); |
|
|
@ -300,8 +300,13 @@ int32_t LP_sock_check(char *typestr,void *ctx,char *myipaddr,int32_t pubsock,int |
|
|
|
#endif |
|
|
|
double millis = OS_milliseconds(); |
|
|
|
if ( strlen((char *)ptr)+sizeof(bits256) <= recvlen ) |
|
|
|
{ |
|
|
|
if ( LP_magic_check(ptr,recvlen,remoteaddr) <= 0 ) |
|
|
|
printf("magic check error\n"); |
|
|
|
{ |
|
|
|
//printf("magic check error\n");
|
|
|
|
} |
|
|
|
recvlen -= sizeof(bits256); |
|
|
|
} |
|
|
|
if ( (retstr= LP_process_message(ctx,typestr,myipaddr,pubsock,ptr,recvlen,sock)) != 0 ) |
|
|
|
free(retstr); |
|
|
|
if ( Broadcaststr != 0 ) |
|
|
@ -664,7 +669,7 @@ void LP_initcoins(void *ctx,int32_t pubsock,cJSON *coins) |
|
|
|
int32_t i,n; cJSON *item; |
|
|
|
for (i=0; i<sizeof(activecoins)/sizeof(*activecoins); i++) |
|
|
|
{ |
|
|
|
fprintf(stderr,"%s ",activecoins[i]); |
|
|
|
printf("%s ",activecoins[i]); |
|
|
|
LP_coinfind(activecoins[i]); |
|
|
|
LP_priceinfoadd(activecoins[i]); |
|
|
|
} |
|
|
@ -673,12 +678,12 @@ void LP_initcoins(void *ctx,int32_t pubsock,cJSON *coins) |
|
|
|
for (i=0; i<n; i++) |
|
|
|
{ |
|
|
|
item = jitem(coins,i); |
|
|
|
fprintf(stderr,"%s ",jstr(item,"coin")); |
|
|
|
printf("%s ",jstr(item,"coin")); |
|
|
|
LP_coincreate(item); |
|
|
|
LP_priceinfoadd(jstr(item,"coin")); |
|
|
|
} |
|
|
|
} |
|
|
|
fprintf(stderr,"privkey updates\n"); |
|
|
|
printf("privkey updates\n"); |
|
|
|
} |
|
|
|
|
|
|
|
void LP_initpeers(int32_t pubsock,struct LP_peerinfo *mypeer,char *myipaddr,uint16_t myport,char *seednode) |
|
|
@ -1020,7 +1025,7 @@ void LPinit(uint16_t myport,uint16_t mypullport,uint16_t mypubport,uint16_t mybu |
|
|
|
G.waiting = 1; |
|
|
|
while ( G.initializing != 0 ) |
|
|
|
{ |
|
|
|
fprintf(stderr,"."); |
|
|
|
//fprintf(stderr,".");
|
|
|
|
sleep(3); |
|
|
|
} |
|
|
|
if ( LP_mainloop_iter(ctx,myipaddr,mypeer,pubsock,pushaddr,myport) != 0 ) |
|
|
|