Browse Source

Remove 7778 and IGUANA_PORT hardcodes

etomic
jl777 8 years ago
parent
commit
a3ca15bcda
  1. 2
      iguana/iguana_accept.c
  2. 10
      iguana/iguana_json.c
  3. 2
      iguana/iguana_rpc.c
  4. 14
      iguana/main.c

2
iguana/iguana_accept.c

@ -115,7 +115,7 @@ void iguana_acceptloop(void *args)
printf("another daemon running, no need to have iguana accept connections\n");
return;
}
//if ( port != IGUANA_RPCPORT )
//if ( port != myinfo->rpcport )
// return;
sleep(5);
}

10
iguana/iguana_json.c

@ -18,7 +18,7 @@
cJSON *helpjson(cJSON *json,cJSON *array,cJSON *agents,char *agentstr,char *method,cJSON *methodargs)
{
cJSON *methodobj,*item; int32_t i,n; char url[2048],curl[2048];
cJSON *methodobj,*item; int32_t i,n; char url[2048],curl[2048]; struct supernet_info *myinfo = SuperNET_MYINFO(0);
/*if ( *agentstrp == 0 || strcmp(*agentstrp,agentstr) != 0 )
{
if ( array != 0 )
@ -43,8 +43,8 @@ cJSON *helpjson(cJSON *json,cJSON *array,cJSON *agents,char *agentstr,char *meth
methodobj = cJSON_CreateObject();
jaddstr(methodobj,"agent",agentstr);
jaddstr(methodobj,"method",method);
sprintf(url,"http://127.0.0.1:7778/api/%s/%s",agentstr,method);
sprintf(curl,"curl --url \"http://127.0.0.1:7778\" --data \"{\\\"agent\\\":\\\"%s\\\",\\\"method\\\":\\\"%s\\\"",agentstr,method);
sprintf(url,"http://127.0.0.1:%u/api/%s/%s",myinfo->rpcport,agentstr,method);
sprintf(curl,"curl --url \"http://127.0.0.1:%u\" --data \"{\\\"agent\\\":\\\"%s\\\",\\\"method\\\":\\\"%s\\\"",myinfo->rpcport,agentstr,method);
if ( methodargs != 0 && (n= cJSON_GetArraySize(methodargs)) > 0 )
{
//printf("method.%s n.%d %s\n",method,n,jprint(methodargs,0));
@ -203,7 +203,7 @@ cJSON *SuperNET_helpjson()
int32_t agentform(FILE *fp,char *form,int32_t max,char *agent,cJSON *methoditem)
{
cJSON *item,*fieldsarray; int32_t j,m,width=1,size = 0;
cJSON *item,*fieldsarray; int32_t j,m,width=1,size = 0; struct supernet_info *myinfo = SuperNET_MYINFO(0);
char *methodstr,*typestr,outstr[2048],outstr2[2048],fields[8192],str[2],agent_method[256],*fieldname;
form[0] = 0;
if ( (methodstr= jstr(methoditem,"method")) == 0 )
@ -252,7 +252,7 @@ int32_t agentform(FILE *fp,char *form,int32_t max,char *agent,cJSON *methoditem)
//printf("fields[%d] (%s)\n",j,fields);
}
} else sprintf(fields+strlen(fields),"<b>%s</b> <textarea rows=\"0\" cols=\"0\"></textarea>",agent_method);
sprintf(&form[size],"<form action=\"http://127.0.0.1:7778/api/%s/%s\" oninput=\"%s\">%s<output for=\"%s\"></output><input type=\"submit\" value=\"%s\"></form>",agent,methodstr,outstr,fields,outstr2,methodstr);
sprintf(&form[size],"<form action=\"http://127.0.0.1:%u/api/%s/%s\" oninput=\"%s\">%s<output for=\"%s\"></output><input type=\"submit\" value=\"%s\"></form>",myinfo->rpcport,agent,methodstr,outstr,fields,outstr2,methodstr);
if ( fp != 0 )
fprintf(fp,"%s\n",&form[size]);
//printf("%s\n",&form[size]);

2
iguana/iguana_rpc.c

@ -759,7 +759,7 @@ char *iguana_bitcoinRPC(struct supernet_info *myinfo,char *method,cJSON *json,ch
//printf("add params[%d] of %d <- (%s) %p.(%p %p)\n",i,n,jprint(params[i],0),params[i],params[i]->next,params[i]->prev);
}
}
retstr = iguana_bitcoinrpc(myinfo,IGUANA_RPCPORT,coin,method,params,n,json,remoteaddr,array);
retstr = iguana_bitcoinrpc(myinfo,myinfo->rpcport,coin,method,params,n,json,remoteaddr,array);
if ( n > 0 )
for (i=0; i<n; i++)
if ( params[i] != 0 )

14
iguana/main.c

@ -290,7 +290,7 @@ char *SuperNET_processJSON(struct supernet_info *myinfo,struct iguana_info *coin
}*/
jsonstr = jprint(json,0);
//printf("RPC? (%s)\n",jsonstr);
if ( (immedmillis= juint(json,"immediate")) != 0 || ((remoteaddr == 0 || remoteaddr[0] == 0) && port == IGUANA_RPCPORT) )
if ( (immedmillis= juint(json,"immediate")) != 0 || ((remoteaddr == 0 || remoteaddr[0] == 0) && port == myinfo->rpcport) )
{
if ( coin != 0 )
{
@ -2051,7 +2051,7 @@ FOUR_STRINGS(SuperNET,login,handle,password,permanentfile,passphrase)
void komodo_ICO_batch(cJSON *array,int32_t batchid)
{
int32_t i,n,iter; cJSON *item; uint64_t kmdamount,revsamount; char *coinaddr,cmd[512]; double totalKMD,totalREVS;
int32_t i,n,iter; cJSON *item; uint64_t kmdamount,revsamount; char *coinaddr,cmd[512]; double totalKMD,totalREVS; struct supernet_info *myinfo = SuperNET_MYINFO(0);
if ( (n= cJSON_GetArraySize(array)) > 0 )
{
totalKMD = totalREVS = 0;
@ -2070,7 +2070,7 @@ void komodo_ICO_batch(cJSON *array,int32_t batchid)
{
if ( dstr(revsamount) >= 1. && (iter & 1) == 0 )
{
printf("curl --url \"http://127.0.0.1:7778\" --data \"{\\\"agent\\\":\\\"dex\\\",\\\"method\\\":\\\"importaddress\\\",\\\"address\\\":\\\"%s\\\",\\\"symbol\\\":\\\"REVS\\\"}\" # %.8f\n",coinaddr,dstr(revsamount));
printf("curl --url \"http://127.0.0.1:%u\" --data \"{\\\"agent\\\":\\\"dex\\\",\\\"method\\\":\\\"importaddress\\\",\\\"address\\\":\\\"%s\\\",\\\"symbol\\\":\\\"REVS\\\"}\" # %.8f\n",myinfo->rpcport,coinaddr,dstr(revsamount));
printf("sleep 3\n");
} else printf("sleep 1\n");
if ( (iter & 1) != 0 )
@ -2093,9 +2093,9 @@ void komodo_ICO_batch(cJSON *array,int32_t batchid)
{
if ( (0) )
{
printf("curl --url \"http://127.0.0.1:7778\" --data \"{\\\"agent\\\":\\\"dex\\\",\\\"method\\\":\\\"importaddress\\\",\\\"address\\\":\\\"%s\\\",\\\"symbol\\\":\\\"KMD\\\"}\" # %.8f\n",coinaddr,dstr(kmdamount));
printf("curl --url \"http://127.0.0.1:%u\" --data \"{\\\"agent\\\":\\\"dex\\\",\\\"method\\\":\\\"importaddress\\\",\\\"address\\\":\\\"%s\\\",\\\"symbol\\\":\\\"KMD\\\"}\" # %.8f\n",myinfo->rpcport,coinaddr,dstr(kmdamount));
printf("sleep 3\n");
} else printf("curl --url \"http://127.0.0.1:7778\" --data \"{\\\"agent\\\":\\\"dex\\\",\\\"method\\\":\\\"listunspent\\\",\\\"address\\\":\\\"%s\\\",\\\"symbol\\\":\\\"KMD\\\"}\"\n",coinaddr);
} else printf("curl --url \"http://127.0.0.1:%u\" --data \"{\\\"agent\\\":\\\"dex\\\",\\\"method\\\":\\\"listunspent\\\",\\\"address\\\":\\\"%s\\\",\\\"symbol\\\":\\\"KMD\\\"}\"\n",myinfo->rpcport,coinaddr);
}
else
{
@ -2114,7 +2114,7 @@ void komodo_ICO_batch(cJSON *array,int32_t batchid)
void komodo_REVS_merge(char *str,char *str2)
{
char line[1024],line2[1024],*coinaddr; int32_t i,n=0,m=0,k=0;
char line[1024],line2[1024],*coinaddr; int32_t i,n=0,m=0,k=0; struct supernet_info *myinfo = SuperNET_MYINFO(0);
while ( 1 )
{
if ( str[n] == 0 || str2[m] == 0 )
@ -2136,7 +2136,7 @@ void komodo_REVS_merge(char *str,char *str2)
coinaddr[i] = 0;
if ( atof(&coinaddr[i+1]) > 1 )
{
printf("curl --url \"http://127.0.0.1:7778\" --data \"{\\\"agent\\\":\\\"dex\\\",\\\"method\\\":\\\"importaddress\\\",\\\"address\\\":\\\"%s\\\",\\\"symbol\\\":\\\"REVS\\\"}\" # %.8f\n",coinaddr,atof(coinaddr+i+1));
printf("curl --url \"http://127.0.0.1:%u\" --data \"{\\\"agent\\\":\\\"dex\\\",\\\"method\\\":\\\"importaddress\\\",\\\"address\\\":\\\"%s\\\",\\\"symbol\\\":\\\"REVS\\\"}\" # %.8f\n",myinfo->rpcport,coinaddr,atof(coinaddr+i+1));
printf("sleep 3\n");
}
k++;

Loading…
Cancel
Save