Browse Source

Dynamic curling

pass-iguana-arg
jl777 7 years ago
parent
commit
4363bbd321
  1. 8
      crypto777/bitcoind_RPC.c

8
crypto777/bitcoind_RPC.c

@ -143,7 +143,7 @@ char *Jay_NXTrequest(char *command,char *params)
char *bitcoind_RPC(char **retstrp,char *debugstr,char *url,char *userpass,char *command,char *params,int32_t timeout) char *bitcoind_RPC(char **retstrp,char *debugstr,char *url,char *userpass,char *command,char *params,int32_t timeout)
{ {
static CURL *curl_handle; static int didinit,count,count2; static double elapsedsum,elapsedsum2; extern int32_t USE_JAY; CURL *curl_handle; static int didinit,count,count2; static double elapsedsum,elapsedsum2; extern int32_t USE_JAY;
struct MemoryStruct chunk; struct MemoryStruct chunk;
struct curl_slist *headers = NULL; struct return_string s; CURLcode res; struct curl_slist *headers = NULL; struct return_string s; CURLcode res;
char *bracket0,*bracket1,*retstr,*databuf = 0; long len; int32_t specialcase,numretries; double starttime; char *bracket0,*bracket1,*retstr,*databuf = 0; long len; int32_t specialcase,numretries; double starttime;
@ -151,7 +151,7 @@ char *bitcoind_RPC(char **retstrp,char *debugstr,char *url,char *userpass,char *
{ {
didinit = 1; didinit = 1;
curl_global_init(CURL_GLOBAL_ALL); //init the curl session curl_global_init(CURL_GLOBAL_ALL); //init the curl session
curl_handle = curl_easy_init(); //curl_handle = curl_easy_init();
} }
if ( (0) && (USE_JAY != 0 && (strncmp(url,"http://127.0.0.1:7876/nxt",strlen("http://127.0.0.1:7876/nxt")) == 0 || strncmp(url,"https://127.0.0.1:7876/nxt",strlen("https://127.0.0.1:7876/nxt")) == 0)) ) if ( (0) && (USE_JAY != 0 && (strncmp(url,"http://127.0.0.1:7876/nxt",strlen("http://127.0.0.1:7876/nxt")) == 0 || strncmp(url,"https://127.0.0.1:7876/nxt",strlen("https://127.0.0.1:7876/nxt")) == 0)) )
{ {
@ -174,7 +174,7 @@ try_again:
if ( retstrp != 0 ) if ( retstrp != 0 )
*retstrp = 0; *retstrp = 0;
starttime = OS_milliseconds(); starttime = OS_milliseconds();
//curl_handle = curl_easy_init(); curl_handle = curl_easy_init();
headers = curl_slist_append(0,"Expect:"); headers = curl_slist_append(0,"Expect:");
curl_easy_setopt(curl_handle,CURLOPT_USERAGENT,"mozilla/4.0");//"Mozilla/4.0 (compatible; )"); curl_easy_setopt(curl_handle,CURLOPT_USERAGENT,"mozilla/4.0");//"Mozilla/4.0 (compatible; )");
@ -244,7 +244,7 @@ try_again:
//laststart = milliseconds(); //laststart = milliseconds();
res = curl_easy_perform(curl_handle); res = curl_easy_perform(curl_handle);
curl_slist_free_all(headers); curl_slist_free_all(headers);
//curl_easy_cleanup(curl_handle); curl_easy_cleanup(curl_handle);
if ( databuf != 0 ) // clean up temporary buffer if ( databuf != 0 ) // clean up temporary buffer
{ {
free(databuf); free(databuf);

Loading…
Cancel
Save