Browse Source

Test

etomic
jl777 7 years ago
parent
commit
828314c43d
  1. 17
      iguana/exchanges/LP_socket.c

17
iguana/exchanges/LP_socket.c

@ -295,7 +295,21 @@ struct electrum_info *electrum_server(char *symbol,struct electrum_info *ep)
struct electrum_info *LP_electrum_info(char *symbol,char *ipaddr,uint16_t port,int32_t bufsize)
{
struct electrum_info *ep; struct stritem *sitem; char name[512],*str = "init string";
struct electrum_info *ep=0; int32_t i; struct stritem *sitem; char name[512],*str = "init string";
portable_mutex_lock(&LP_electrummutex);
for (i=0; i<Num_electrums; i++)
{
ep = Electrums[i];
if ( strcmp(ep->ipaddr,ipaddr) == 0 && ep->port == port && strcmp(ep->symbol,symbol) == 0 )
{
printf("%s.(%s:%u) already an electrum server\n",symbol,ipaddr,port);
break;
}
ep = 0;
}
portable_mutex_unlock(&LP_electrummutex);
if ( ep == 0 )
{
ep = calloc(1,sizeof(*ep) + bufsize);
ep->sock = LP_socket(0,ipaddr,port);
safecopy(ep->symbol,symbol,sizeof(ep->symbol));
@ -312,6 +326,7 @@ struct electrum_info *LP_electrum_info(char *symbol,char *ipaddr,uint16_t port,i
if ( (sitem= queue_dequeue(&ep->pendingQ)) == 0 && strcmp(sitem->str,str) != 0 )
printf("error with string pendingQ sitem.%p (%s)\n",sitem,sitem==0?0:sitem->str);
electrum_server(symbol,ep);
}
return(ep);
}

Loading…
Cancel
Save