jl777 7 years ago
parent
commit
f7da35add9
  1. 26
      iguana/exchanges/LP_ordermatch.c

26
iguana/exchanges/LP_ordermatch.c

@ -1108,6 +1108,7 @@ void LP_tradesloop(void *ctx)
{ {
if ( tp->connectsent == 0 ) if ( tp->connectsent == 0 )
{ {
tp->negotiationdone = (uint32_t)time(NULL);
LP_Alicemaxprice = tp->bestprice; LP_Alicemaxprice = tp->bestprice;
LP_reserved(ctx,LP_myipaddr,LP_mypubsock,&tp->Qs[LP_CONNECT]); // send LP_CONNECT LP_reserved(ctx,LP_myipaddr,LP_mypubsock,&tp->Qs[LP_CONNECT]); // send LP_CONNECT
tp->connectsent = now; tp->connectsent = now;
@ -1123,14 +1124,23 @@ void LP_tradesloop(void *ctx)
} }
} }
} }
if ( now > tp->firstprocessed+timeout*10 ) }
{ }
//printf("purge swap aliceid.%llu\n",(long long)tp->aliceid); now = (uint32_t)time(NULL);
portable_mutex_lock(&LP_tradesmutex); HASH_ITER(hh,LP_trades,tp,tmp)
HASH_DELETE(hh,LP_trades,tp); {
portable_mutex_unlock(&LP_tradesmutex); timeout = LP_AUTOTRADE_TIMEOUT;
free(tp); if ( (coin= LP_coinfind(tp->Q.srccoin)) != 0 && coin->electrum != 0 )
} timeout += LP_AUTOTRADE_TIMEOUT * .5;
if ( (coin= LP_coinfind(tp->Q.destcoin)) != 0 && coin->electrum != 0 )
timeout += LP_AUTOTRADE_TIMEOUT * .5;
if ( now > tp->firstprocessed+timeout*10 )
{
printf("purge swap aliceid.%llu\n",(long long)tp->aliceid);
portable_mutex_lock(&LP_tradesmutex);
HASH_DELETE(hh,LP_trades,tp);
portable_mutex_unlock(&LP_tradesmutex);
free(tp);
} }
} }
if ( nonz == 0 ) if ( nonz == 0 )

Loading…
Cancel
Save