Browse Source

test

release/v0.1
jl777 9 years ago
parent
commit
ee3af1c290
  1. 4
      iguana/iguana777.c
  2. 6
      iguana/iguana_json.c
  3. 10
      iguana/iguana_ramchain.c
  4. 5
      iguana/iguana_rpc.c
  5. 13
      iguana/main.c

4
iguana/iguana777.c

@ -557,8 +557,8 @@ void iguana_coinloop(void *arg)
if ( coin->MAXPEERS < IGUANA_MINPEERS )
coin->MAXPEERS = IGUANA_MAXPEERS;
#ifdef __PNACL__
if ( strcmp(coin->symbol,"BTC") == 0 )
continue;
//if ( strcmp(coin->symbol,"BTC") == 0 )
// continue;
if ( coin->MAXPEERS > 64 )
coin->MAXPEERS = 64;
#endif

6
iguana/iguana_json.c

@ -362,7 +362,7 @@ cJSON *update_docjson(cJSON *docjson,char *agent,char *method)
if ( agent != 0 && method != 0 )
{
sprintf(stubstr,"{\"agent\":\"%s\",\"method\":\"%s\",\"field0\":\"put in helpful info field0\",\"field1\":\"put in helpful info for field1\",\"help\":\"put helpful info here\",\"teststatus\":[{\"tester\":\"bob\",\"result\":\"put result here\",\"notes\":\"put useful notes here\",\"automated\":\"notyet\",\"sourcefile\":\"%s_%s_test.py\"}]}",agent,method,agent,method);
sprintf(fname,"help/%s_%s.json",agent,method);
sprintf(fname,"%s/%s_%s.json",GLOBAL_HELPDIR,agent,method);
if ( (docstr= OS_filestr(&allocsize,fname)) != 0 )
{
if ( (item= cJSON_Parse(docstr)) == 0 )
@ -390,7 +390,7 @@ cJSON *update_docjson(cJSON *docjson,char *agent,char *method)
char *formfname(char *name,char *suffix)
{
static char retbuf[512];
sprintf(retbuf,"help/%s.%s",name,suffix);
sprintf(retbuf,"%s/%s.%s",GLOBAL_HELPDIR,name,suffix);
return(retbuf);
}
@ -472,7 +472,7 @@ char *SuperNET_htmlstr(char *fname,char *htmlstr,int32_t maxsize,char *agentstr)
pretty_forms(fname,agentstr,"html");
printf("autocreate %s\n","_API.md");
pretty_forms("_API.md",0,"md");
return(OS_filestr(&filesize,"index7778.html"));
return(OS_filestr(&filesize,"index7778.html"));
sprintf(htmlstr,"<!DOCTYPE HTML><html> <head><title>SuperUGLY GUI></title></head> <body> ");
size = (int32_t)strlen(htmlstr);
if ( (helpjson= SuperNET_helpjson()) != 0 )

10
iguana/iguana_ramchain.c

@ -1008,10 +1008,10 @@ long iguana_ramchain_save(struct iguana_info *coin,RAMCHAIN_FUNC,uint32_t ipbits
return(-1);
}
}*/
/*#ifdef __PNACL__
#ifdef __PNACL__
static portable_mutex_t mutex;
portable_mutex_lock(&mutex);
#endif*/
#endif
if ( (fp= fopen(fname,"wb")) == 0 )
printf("iguana_ramchain_save: couldnt create.(%s) errno.%d\n",fname,errno);
else coin->peers.numfiles++;
@ -1029,9 +1029,9 @@ long iguana_ramchain_save(struct iguana_info *coin,RAMCHAIN_FUNC,uint32_t ipbits
*rdata = tmp;
fclose(fp);
}
//#ifdef __PNACL__
// portable_mutex_unlock(&mutex);
//#endif
#ifdef __PNACL__
portable_mutex_unlock(&mutex);
#endif
return(fpos);
}

5
iguana/iguana_rpc.c

@ -997,7 +997,7 @@ void iguana_rpcloop(void *args)
static char *jsonbuf;
uint16_t port; struct supernet_info *myinfo = args; char filetype[128],content_type[128];
int32_t recvlen,flag,bindsock,postflag,contentlen,sock,remains,numsent,jsonflag,hdrsize,len;
socklen_t clilen; char remoteaddr[64],*buf,*retstr,*space;//,*retbuf; ,n,i,m
socklen_t clilen; char helpname[512],remoteaddr[64],*buf,*retstr,*space;//,*retbuf; ,n,i,m
struct sockaddr_in cli_addr; uint32_t ipbits,i,size = IGUANA_WIDTH*IGUANA_HEIGHT*16 + 512;
port = myinfo->rpcport;
if ( jsonbuf == 0 )
@ -1086,7 +1086,8 @@ void iguana_rpcloop(void *args)
if ( filetype[0] != 0 )
{
static cJSON *mimejson; char *tmp,*typestr=0; long tmpsize;
if ( (tmp= OS_filestr(&tmpsize,"help/mime.json")) != 0 )
sprintf(helpname,"%s/mime.json",GLOBAL_HELPDIR);
if ( (tmp= OS_filestr(&tmpsize,helpname)) != 0 )
{
mimejson = cJSON_Parse(tmp);
free(tmp);

13
iguana/main.c

@ -70,10 +70,10 @@ cJSON *API_json;
#ifdef __PNACL__
char GLOBAL_TMPDIR[512] = "/tmp";
char GLOBAL_DBDIR[512] = "/DB";
char GLOBAL_HELPDIR[512] = "/DB/help";
char GLOBAL_VALIDATEDIR[512] = "/DB/purgeable";
char GLOBAL_CONFSDIR[512] = "/DB/confs";
int32_t IGUANA_NUMHELPERS = 1;
char GLOBAL_HELPDIR[512] = "help";
char GLOBAL_VALIDATEDIR[512] = "purgeable";
char GLOBAL_CONFSDIR[512] = "confs";
int32_t IGUANA_NUMHELPERS = 2;
#else
char GLOBAL_TMPDIR[512] = "tmp";
char GLOBAL_HELPDIR[512] = "help";
@ -1229,14 +1229,15 @@ void iguana_Qinit()
void iguana_helpinit(struct supernet_info *myinfo)
{
char *tmpstr;
char *tmpstr = 0;
if ( (tmpstr= SuperNET_JSON(myinfo,cJSON_Parse("{\"agent\":\"SuperNET\",\"method\":\"help\"}"),0,myinfo->rpcport)) != 0 )
{
if ( (API_json= cJSON_Parse(tmpstr)) != 0 && (API_json= jobj(API_json,"result")) != 0 )
API_json = jobj(API_json,"API");
else printf("couldnt parse tmpstr\n");
free(tmpstr);
}
printf("generated API_json\n");
printf("generated API_json tmpstr.%p\n",tmpstr);
}
void iguana_urlinit(struct supernet_info *myinfo,int32_t ismainnet,int32_t usessl)

Loading…
Cancel
Save