Browse Source

Merge pull request #743 from jl777/jl777

fix 0conf SPV claim
patch-3
jl777 7 years ago
committed by GitHub
parent
commit
aed0b8eb12
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      iguana/exchanges/LP_cache.c
  2. 2
      iguana/exchanges/LP_commands.c
  3. 4
      iguana/exchanges/LP_include.h
  4. 50
      iguana/exchanges/LP_instantdex.c
  5. 6
      iguana/exchanges/LP_nativeDEX.c
  6. 2
      iguana/exchanges/LP_ordermatch.c
  7. 2
      iguana/exchanges/LP_portfolio.c
  8. 14
      iguana/exchanges/LP_remember.c
  9. 7
      iguana/exchanges/LP_rpc.c
  10. 2
      iguana/exchanges/LP_socket.c
  11. 2
      iguana/exchanges/LP_tradebots.c
  12. 4
      iguana/exchanges/LP_transaction.c
  13. 31
      iguana/exchanges/LP_utxo.c
  14. 2
      iguana/exchanges/coins
  15. 23
      iguana/exchanges/stats.c

2
iguana/exchanges/LP_cache.c

@ -53,7 +53,7 @@ struct LP_transaction *LP_create_transaction(struct iguana_info *coin,bits256 tx
for (i=0; i<numvouts; i++)
{
vout = jitem(vouts,i);
tx->outpoints[i].value = LP_value_extract(vout,0);
tx->outpoints[i].value = LP_value_extract(vout,0,txid);
tx->outpoints[i].interest = SATOSHIDEN * jdouble(vout,"interest");
LP_destaddr(tx->outpoints[i].coinaddr,vout);
//printf("from transaction init %s %s %s/v%d <- %.8f\n",coin->symbol,tx->outpoints[i].coinaddr,bits256_str(str,txid),i,dstr(tx->outpoints[i].value));

2
iguana/exchanges/LP_commands.c

@ -306,7 +306,7 @@ jpg(srcfile, destfile, power2=7, password, data="", required, ind=0)\n\
}*/
else if ( strcmp(method,"recentswaps") == 0 )
{
return(LP_recent_swaps(jint(argjson,"limit")));
return(LP_recent_swaps(jint(argjson,"limit"),0));
}
else if ( strcmp(method,"stop") == 0 )
{

4
iguana/exchanges/LP_include.h

@ -35,7 +35,7 @@ voind dontprintf(char *formatstr,...) {}
#define LP_MAJOR_VERSION "0"
#define LP_MINOR_VERSION "1"
#define LP_BUILD_NUMBER "27772"
#define LP_BUILD_NUMBER "27773"
#define LP_BARTERDEX_VERSION 1
#define LP_MAGICBITS 1
@ -479,7 +479,7 @@ int32_t LP_rawtx_spendscript(struct basilisk_swap *swap,int32_t height,struct ba
void LP_quotesinit(char *base,char *rel);
int32_t LP_forward(void *ctx,char *myipaddr,int32_t pubsock,bits256 pubkey,char *jsonstr,int32_t freeflag);
struct LP_peerinfo *LP_peerfind(uint32_t ipbits,uint16_t port);
uint64_t LP_value_extract(cJSON *obj,int32_t addinterest);
uint64_t LP_value_extract(cJSON *obj,int32_t addinterest,bits256 txid);
int32_t LP_swap_getcoinaddr(char *symbol,char *coinaddr,bits256 txid,int32_t vout);
char *LP_command_process(void *ctx,char *myipaddr,int32_t pubsock,cJSON *argjson,uint8_t *data,int32_t datalen,int32_t stats_JSONonly);
int64_t LP_kmdvalue(char *symbol,int64_t satoshis);

50
iguana/exchanges/LP_instantdex.c

@ -82,8 +82,34 @@ void LP_instantdex_deposituniq(FILE *fp,bits256 txid)
void LP_instantdex_filescreate(char *coinaddr)
{
char fname[512]; FILE *fp; bits256 txid; int32_t i,n; cJSON *array,*newarray,*txobj;
char fname[512]; FILE *fp; bits256 txid; int32_t i,j,n; cJSON *array,*newarray,*txobj;
sprintf(fname,"%s/deposits.%s",GLOBAL_DBDIR,coinaddr), OS_compatible_path(fname);
if ( (fp= fopen(fname,"rb")) == 0 )
{
if ( (fp= fopen(fname,"wb+")) != 0 )
{
//printf("created %s\n",fname);
for (i=0; i<2; i++)
{
if ( (array= LP_instantdex_txids(i,coinaddr)) != 0 )
{
if ( (n= cJSON_GetArraySize(array)) > 0 )
{
for (j=0; j<n; j++)
{
txid = jbits256i(array,j);
//char str[65]; printf("j.%d of %d: %s\n",j,n,bits256_str(str,txid));
LP_instantdex_deposituniq(fp,txid);
fflush(fp);
}
}
//printf("i.%d n.%d\n",i,n);
free_json(array);
}
}
fclose(fp);
} else printf("couldnt create %s\n",fname);
} else fclose(fp);
if ( (fp= fopen(fname,"rb")) != 0 )
{
array = cJSON_CreateArray();
@ -94,7 +120,7 @@ void LP_instantdex_filescreate(char *coinaddr)
{
fseek(fp,sizeof(txid) * i,SEEK_SET);
if ( fread(&txid,1,sizeof(txid),fp) != sizeof(txid) )
printf("error reating %s\n",fname);
printf("error creating %s\n",fname);
jaddibits256(array,txid);
if ( (txobj= LP_gettxout("KMD",coinaddr,txid,0)) != 0 )
free_json(txobj);
@ -312,7 +338,7 @@ char *LP_unlockedspend(void *ctx,char *symbol,bits256 utxotxid)
{
vout0 = jitem(vouts,0);
LP_destaddr(vinaddr,vout0);
satoshis = LP_value_extract(vout0,0);
satoshis = LP_value_extract(vout0,0,utxotxid);
opret = jitem(vouts,numvouts - 1);
jaddstr(retjson,"result","success");
jaddbits256(retjson,"lockedtxid",utxotxid);
@ -396,20 +422,20 @@ char *LP_timelock(char *symbol,uint32_t duration,char *destaddr,uint64_t satoshi
int32_t LP_claim_submit(void *ctx,cJSON *txids,int64_t *sump,struct iguana_info *coin,bits256 utxotxid)
{
uint8_t redeemscript[512]; bits256 claimtxid; cJSON *txjson,*vout0,*vout1,*vout2,*vouts,*item; int32_t numvouts; char str[65],vinaddr[64],destaddr[64],checkaddr[64]; int32_t j,utxovout,flagi = 0,redeemlen,weeki,iter; int64_t weeksatoshis,satoshis; uint32_t expiration,claimtime;
uint8_t redeemscript[512]; bits256 claimtxid; cJSON *txjson,*vout0,*vout1,*vout2,*vouts,*item; int32_t numvouts; char str[65],vinaddr[64],destaddr[64],checkaddr[64]; int32_t j,utxovout,flagi = 0,redeemlen,weeki,iter; int64_t weeksatoshis,satoshis,interest; uint32_t expiration,claimtime;
if ( (txjson= LP_gettx("LP_claim_submit",coin->symbol,utxotxid,1)) != 0 )
{
if ( (vouts= jarray(&numvouts,txjson,"vout")) != 0 && numvouts >= 3 )
{
vout0 = jitem(vouts,0);
LP_destaddr(vinaddr,vout0);
satoshis = LP_value_extract(vout0,1);
satoshis = LP_value_extract(vout0,1,utxotxid);
vout2 = jitem(vouts,2);
LP_destaddr(destaddr,vout2);
if ( strcmp(destaddr,coin->smartaddr) == 0 )
{
vout1 = jitem(vouts,1);
weeksatoshis = LP_value_extract(vout1,0);
weeksatoshis = LP_value_extract(vout1,0,utxotxid);
weeki = (int32_t)(weeksatoshis % 10000);
for (iter=0; iter<2; iter++)
for (j=-168; j<=168; j++)
@ -425,10 +451,12 @@ int32_t LP_claim_submit(void *ctx,cJSON *txids,int64_t *sump,struct iguana_info
//claimtime = LP_claimtime(coin,expiration);
item = cJSON_CreateObject();
jaddbits256(item,"txid",utxotxid);
jaddnum(item,"deposit",dstr(LP_value_extract(vout0,0)));
jaddnum(item,"deposit",dstr(LP_value_extract(vout0,0,utxotxid)));
if ( coin->electrum == 0 )
jaddnum(item,"interest",dstr(satoshis)-dstr(LP_value_extract(vout0,0)));
else jaddnum(item,"interest",dstr(LP_komodo_interest(utxotxid,satoshis)));
interest = dstr(satoshis) - dstr(LP_value_extract(vout0,0,utxotxid));
else interest = dstr(LP_komodo_interest(utxotxid,satoshis));
jaddnum(item,"interest",interest);
//printf("%.8f %.8f %.8f\n",dstr(satoshis),dstr(LP_value_extract(vout0,0,utxotxid)),dstr(LP_komodo_interest(utxotxid,satoshis)));
if ( claimtime <= expiration )
{
printf("iter.%d j.%d claimtime.%u vs %u, wait %d seconds to %s claim %.8f\n",iter,j,claimtime,expiration,(int32_t)expiration-claimtime,bits256_str(str,utxotxid),dstr(satoshis));
@ -526,10 +554,10 @@ int64_t LP_instantdex_creditcalc(struct iguana_info *coin,int32_t dispflag,bits2
}
else
{
amount64 = LP_value_extract(jitem(vouts,1),0);
amount64 = LP_value_extract(jitem(vouts,1),0,txid);
weeki = (amount64 % 10000);
item = jitem(vouts,0);
satoshis = LP_value_extract(item,0);
satoshis = LP_value_extract(item,0,txid);
//char str[65]; printf("%s %s funded %.8f weeki.%d (%s)\n",bits256_str(str,txid),destaddr,dstr(satoshis),weeki,jprint(item,0));
if ( LP_destaddr(p2shaddr,item) == 0 )
{

6
iguana/exchanges/LP_nativeDEX.c

@ -512,6 +512,7 @@ void command_rpcloop(void *ctx)
void LP_coinsloop(void *_coins)
{
static int32_t didfilescreate;
struct LP_address *ap=0; struct LP_transaction *tx; cJSON *retjson; struct LP_address_utxo *up,*tmp; struct iguana_info *coin,*ctmp; char str[65]; struct electrum_info *ep,*backupep=0; bits256 zero; int32_t notarized,oldht,j,nonz; char *coins = _coins;
if ( strcmp("BTC",coins) == 0 )
{
@ -561,6 +562,11 @@ void LP_coinsloop(void *_coins)
//printf("%s has no smartaddress??\n",coin->symbol);
continue;
}
if ( didfilescreate == 0 && strcmp("KMD",coin->symbol) == 0 )
{
LP_instantdex_filescreate(coin->smartaddr);
didfilescreate = 1;
}
memset(&zero,0,sizeof(zero));
if ( coin->inactive != 0 )
continue;

2
iguana/exchanges/LP_ordermatch.c

@ -579,7 +579,7 @@ char *LP_trade(void *ctx,char *myipaddr,int32_t mypubsock,struct LP_quoteinfo *q
LP_query(ctx,myipaddr,mypubsock,"request",qp);
LP_Alicequery = *qp, LP_Alicemaxprice = maxprice, Alice_expiration = qp->timestamp + timeout, LP_Alicedestpubkey = destpubkey;
char str[65]; printf("LP_trade %s/%s %.8f vol %.8f dest.(%s) maxprice %.8f etomicdest.(%s)\n",qp->srccoin,qp->destcoin,dstr(qp->satoshis),dstr(qp->destsatoshis),bits256_str(str,LP_Alicedestpubkey),maxprice,qp->etomicdest);
return(LP_recent_swaps(0));
return(LP_recent_swaps(0,qp->R.requestid));
}
int32_t LP_quotecmp(int32_t strictflag,struct LP_quoteinfo *qp,struct LP_quoteinfo *qp2)

2
iguana/exchanges/LP_portfolio.c

@ -110,7 +110,7 @@ uint64_t LP_balance(uint64_t *valuep,int32_t iambob,char *symbol,char *coinaddr)
for (i=0; i<n; i++)
{
item = jitem(array,i);
value = LP_value_extract(item,1);
value = LP_value_extract(item,0,zero);
valuesum += value;
}
}

14
iguana/exchanges/LP_remember.c

@ -940,7 +940,7 @@ int32_t LP_swap_load(struct LP_swap_remember *rswap,int32_t forceflag)
rswap->Dredeemlen >>= 1;
decode_hex(rswap->Dredeemscript,rswap->Dredeemlen,rstr);
}
rswap->values[i] = value = LP_value_extract(txobj,1);
rswap->values[i] = value = LP_value_extract(txobj,1,txid);
if ( (symbol= jstr(txobj,"src")) != 0 )
{
safecopy(rswap->src,symbol,sizeof(rswap->src));
@ -1681,7 +1681,7 @@ char *basilisk_swapentry(int32_t fastflag,uint32_t requestid,uint32_t quoteid,in
extern struct LP_quoteinfo LP_Alicequery;
extern uint32_t Alice_expiration;
char *LP_recent_swaps(int32_t limit)
char *LP_recent_swaps(int32_t limit,uint32_t origrequestid)
{
char fname[512],*retstr,*base,*rel,*statusstr; long fsize,offset; FILE *fp; int32_t baseind,relind,i=0; uint32_t requestid,quoteid; cJSON *array,*item,*retjson,*subitem,*swapjson; int64_t KMDtotals[LP_MAXPRICEINFOS],BTCtotals[LP_MAXPRICEINFOS]; double srcamount,destamount,netamounts[LP_MAXPRICEINFOS];
memset(KMDtotals,0,sizeof(KMDtotals));
@ -1772,9 +1772,15 @@ char *LP_recent_swaps(int32_t limit)
jaddstr(item,"alice",LP_Alicequery.destcoin);
jaddstr(item,"rel",LP_Alicequery.destcoin);
jaddnum(item,"relvalue",dstr(LP_Alicequery.destsatoshis));
jaddbits256(item,"desthash",G.LP_mypub25519);
jadd64bits(item,"aliceid",LP_aliceid_calc(LP_Alicequery.desttxid,LP_Alicequery.destvout,LP_Alicequery.feetxid,LP_Alicequery.feevout));
jadd(retjson,"pending",item);
} else Alice_expiration = 0;
if ( origrequestid != 0 )
{
jaddnum(retjson,"requestid",origrequestid);
jaddbits256(retjson,"desthash",G.LP_mypub25519);
}
return(jprint(retjson,1));
}
@ -1833,7 +1839,7 @@ char *basilisk_swapentries(int32_t fastflag,char *refbase,char *refrel,int32_t l
}
free(liststr);
}
if ( (liststr= LP_recent_swaps(limit)) != 0 )
if ( (liststr= LP_recent_swaps(limit,0)) != 0 )
{
if ( (retjson= cJSON_Parse(liststr)) != 0 )
{
@ -1894,7 +1900,7 @@ char *basilisk_swapentries(int32_t fastflag,char *refbase,char *refrel,int32_t l
int32_t LP_pendingswap(uint32_t requestid,uint32_t quoteid)
{
cJSON *retjson,*array,*pending,*item; uint32_t r,q; char *retstr; int32_t i,n,retval = 0;
if ( (retstr= LP_recent_swaps(1000)) != 0 )
if ( (retstr= LP_recent_swaps(1000,0)) != 0 )
{
if ( (retjson= cJSON_Parse(retstr)) != 0 )
{

7
iguana/exchanges/LP_rpc.c

@ -136,8 +136,9 @@ int32_t LP_getheight(int32_t *notarizedp,struct iguana_info *coin)
uint64_t LP_RTsmartbalance(struct iguana_info *coin)
{
cJSON *array,*item; char buf[512],*retstr; int32_t i,n; uint64_t valuesum,value;
cJSON *array,*item; char buf[512],*retstr; int32_t i,n; uint64_t valuesum,value; bits256 zero;
valuesum = 0;
memset(zero.bytes,0,sizeof(zero));
sprintf(buf,"[0, 99999999, [\"%s\"]]",coin->smartaddr);
retstr = bitcoind_passthru(coin->symbol,coin->serverport,coin->userpass,"listunspent",buf);
if ( retstr != 0 && retstr[0] != 0 )
@ -148,7 +149,7 @@ uint64_t LP_RTsmartbalance(struct iguana_info *coin)
for (i=0; i<n; i++)
{
item = jitem(array,i);
value = LP_value_extract(item,1);
value = LP_value_extract(item,0,zero);
valuesum += value;
//printf("%s -> %.8f\n",jprint(item,0),dstr(value));
}
@ -535,7 +536,7 @@ int64_t LP_listunspent_parseitem(struct iguana_info *coin,bits256 *txidp,int32_t
{
*txidp = jbits256(item,"txid");
*voutp = juint(item,"vout");
satoshis = LP_value_extract(item,0);
satoshis = LP_value_extract(item,0,*txidp);
*heightp = LP_txheight(coin,*txidp);
}
else

2
iguana/exchanges/LP_socket.c

@ -296,7 +296,7 @@ int32_t electrum_process_array(struct iguana_info *coin,struct electrum_info *ep
{
txid = jbits256(item,"txid");
v = jint(item,"vout");
value = LP_value_extract(item,0);
value = LP_value_extract(item,0,txid);
ht = LP_txheight(coin,txid);
if ( (retjson= LP_gettxout(coin->symbol,coinaddr,txid,v)) != 0 )
free_json(retjson);

2
iguana/exchanges/LP_tradebots.c

@ -322,7 +322,7 @@ void LP_tradebot_timeslice(void *ctx,struct LP_tradebot *bot)
LP_tradebot_calcstats(bot);
if ( bot->dead == 0 && bot->pause == 0 && bot->userpause == 0 && bot->numtrades < sizeof(bot->trades)/sizeof(*bot->trades) )
{
if ( (liststr= LP_recent_swaps(0)) != 0 )
if ( (liststr= LP_recent_swaps(0,0)) != 0 )
{
if ( (retjson= cJSON_Parse(liststr)) != 0 )
{

4
iguana/exchanges/LP_transaction.c

@ -795,7 +795,7 @@ char *basilisk_swap_bobtxspend(bits256 *signedtxidp,uint64_t txfee,char *name,ch
if ( (vouts= jarray(&n,txobj,"vout")) != 0 && utxovout < n )
{
obj = jitem(vouts,utxovout);
value = LP_value_extract(obj,1);
value = LP_value_extract(obj,1,utxotxid);
//printf("value in vout.%d %.8f (%s)\n",vout,dstr(value),jprint(txobj,0));
}
free_json(txobj);
@ -2155,7 +2155,7 @@ void LP_swap_coinaddr(struct iguana_info *coin,char *coinaddr,uint64_t *valuep,u
{
vout = jitem(vouts,v);
if ( valuep != 0 )
*valuep = LP_value_extract(vout,1);
*valuep = LP_value_extract(vout,1,signedtxid);
LP_destaddr(coinaddr,vout);
}
free_json(txobj);

31
iguana/exchanges/LP_utxo.c

@ -206,9 +206,9 @@ int32_t LP_nearestvalue(int32_t iambob,uint64_t *values,int32_t n,uint64_t targe
return(mini);
}
uint64_t LP_value_extract(cJSON *obj,int32_t addinterest)
uint64_t LP_value_extract(cJSON *obj,int32_t addinterest,bits256 utxotxid)
{
double val = 0.; uint64_t value = 0; int32_t electrumflag;
double val = 0.; uint64_t interest,value = 0; int32_t electrumflag;
electrumflag = (jobj(obj,"tx_hash") != 0);
if ( electrumflag == 0 )
{
@ -218,8 +218,17 @@ uint64_t LP_value_extract(cJSON *obj,int32_t addinterest)
} else value = j64bits(obj,"value");
if ( value != 0 )
{
if ( addinterest != 0 && jobj(obj,"interest") != 0 )
value += (jdouble(obj,"interest") * SATOSHIDEN);
if ( addinterest != 0 )
{
if ( jobj(obj,"interest") != 0 )
value += (jdouble(obj,"interest") * SATOSHIDEN);
else
{
interest = LP_komodo_interest(utxotxid,value);
//char str[65]; printf("(%s) txid.%s %.8f + %.8f\n",jprint(obj,0),bits256_str(str,utxotxid),dstr(value),dstr(interest));
value += interest;
}
}
}
return(value);
}
@ -358,7 +367,7 @@ int32_t LP_address_utxo_ptrs(struct iguana_info *coin,int32_t iambob,struct LP_a
{
if ( (txout= LP_gettxout(coin->symbol,coinaddr,up->U.txid,up->U.vout)) != 0 )
{
if ( LP_value_extract(txout,0) == 0 )
if ( LP_value_extract(txout,0,up->U.txid) == 0 )
{
//char str[65]; printf("LP_address_utxo_ptrs skip zero value %s/v%d\n",bits256_str(str,up->U.txid),up->U.vout);
free_json(txout);
@ -693,7 +702,7 @@ cJSON *LP_address_balance(struct iguana_info *coin,char *coinaddr,int32_t electr
for (i=0; i<n; i++)
{
item = jitem(array,i);
balance += LP_value_extract(item,1);
balance += LP_value_extract(item,1,zero);
//printf("i.%d (%s) balance %.8f\n",i,jprint(item,0),dstr(balance));
}
}
@ -813,7 +822,7 @@ int32_t LP_unspents_array(struct iguana_info *coin,char *coinaddr,cJSON *array)
val = j64bits(item,"value");
if ( coin->electrum == 0 && (txobj= LP_gettxout(coin->symbol,coinaddr,txid,v)) != 0 )
{
value = LP_value_extract(txobj,0);
value = LP_value_extract(txobj,0,txid);
if ( value != 0 && value != val )
{
char str[65]; printf("REJECT %s %s/v%d value.%llu vs %llu (%s)\n",coin->symbol,bits256_str(str,txid),v,(long long)value,(long long)val,jprint(txobj,0));
@ -893,7 +902,7 @@ cJSON *LP_transactioninit(struct iguana_info *coin,bits256 txid,int32_t iter,cJS
for (i=0; i<numvouts; i++)
{
vout = jitem(vouts,i);
tx->outpoints[i].value = LP_value_extract(vout,0);
tx->outpoints[i].value = LP_value_extract(vout,0,txid);
tx->outpoints[i].interest = SATOSHIDEN * jdouble(vout,"interest");
LP_destaddr(tx->outpoints[i].coinaddr,vout);
//printf("from transaction init %s %s %s/v%d <- %.8f\n",coin->symbol,tx->outpoints[i].coinaddr,bits256_str(str,txid),i,dstr(tx->outpoints[i].value));
@ -1046,7 +1055,7 @@ uint64_t LP_txinterestvalue(uint64_t *interestp,char *destaddr,struct iguana_inf
destaddr[0] = 0;
if ( (txobj= LP_gettxout(coin->symbol,destaddr,txid,vout)) != 0 )
{
if ( (value= LP_value_extract(txobj,0)) == 0 )
if ( (value= LP_value_extract(txobj,0,txid)) == 0 )
{
char str[65]; printf("%s LP_txvalue.%s strange utxo.(%s) vout.%d\n",coin->symbol,bits256_str(str,txid),jprint(txobj,0),vout);
}
@ -1123,7 +1132,7 @@ uint64_t LP_txvalue(char *coinaddr,char *symbol,bits256 txid,int32_t vout)
uint64_t value; char str[65];
if ( (txobj= LP_gettxout(coin->symbol,coinaddr,txid,vout)) != 0 )
{
value = LP_value_extract(txobj,0);//SATOSHIDEN * (jdouble(txobj,"value") + jdouble(txobj,"interest"));
value = LP_value_extract(txobj,0,txid);//SATOSHIDEN * (jdouble(txobj,"value") + jdouble(txobj,"interest"));
if ( coinaddr != 0 )
LP_destaddr(coinaddr,txobj);
//printf("LP_txvalue %s tx %s/v%d value %.8f\n",coin->symbol,bits256_str(str,txid),vout,dstr(value));
@ -1150,7 +1159,7 @@ int64_t LP_outpoint_amount(char *symbol,bits256 txid,int32_t vout)
if ( (txjson= LP_gettx("LP_outpoint_amount",symbol,txid,1)) != 0 )
{
if ( (vouts= jarray(&numvouts,txjson,"vout")) != 0 && vout < numvouts )
amount = LP_value_extract(jitem(vouts,vout),0);
amount = LP_value_extract(jitem(vouts,vout),0,txid);
free_json(txjson);
}
}

2
iguana/exchanges/coins

File diff suppressed because one or more lines are too long

23
iguana/exchanges/stats.c

@ -833,7 +833,6 @@ void stats_rpcloop(void *args)
//printf("after sock.%d\n",sock);
clilen = sizeof(cli_addr);
sock = accept(bindsock,(struct sockaddr *)&cli_addr,&clilen);
//#ifdef _WIN32
if ( sock < 0 )
{
printf("iguana_rpcloop ERROR on accept port.%u usock.%d errno %d %s\n",port,sock,errno,strerror(errno));
@ -841,16 +840,6 @@ void stats_rpcloop(void *args)
bindsock = -1;
continue;
}
/*#else
if ( sock < 0 )
{
//fprintf(stderr,".");
if ( IAMLP == 0 )
usleep(50000);
else usleep(2500);
continue;
}
#endif*/
memcpy(&ipbits,&cli_addr.sin_addr.s_addr,sizeof(ipbits));
//printf("port.%u got incoming from %x\n",port,ipbits);
if ( DOCKERFLAG != 0 && (DOCKERFLAG == 1 || ipbits == DOCKERFLAG) )
@ -873,18 +862,6 @@ void stats_rpcloop(void *args)
{
printf("error launching rpc handler on port %d, retval.%d\n",port,retval);
LP_rpc_processreq(req);
/*portable_mutex_lock(&LP_gcmutex);
DL_FOREACH_SAFE(LP_garbage_collector,req2,rtmp)
{
DL_DELETE(LP_garbage_collector,req2);
free(req2);
}
portable_mutex_unlock(&LP_gcmutex);
if ( (retval= OS_thread_create(&req->T,NULL,(void *)LP_rpc_processreq,req)) != 0 )
{
printf("error2 launching rpc handler on port %d, retval.%d\n",port,retval);
LP_rpc_processreq(req);
}*/
}
}
printf("i got killed\n");

Loading…
Cancel
Save