jl777 7 years ago
parent
commit
552ba77ba4
  1. 6
      iguana/exchanges/fasttest
  2. 13
      iguana/exchanges/stats.c

6
iguana/exchanges/fasttest

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
source userpass source userpass
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"sleep\"}" & curl --url "http://127.0.0.1:7783" --data "{\"queueid\":1,\"userpass\":\"$userpass\",\"method\":\"sleep\",\"seconds\":10}" &
curl --url "http://127.0.0.1:7782" --data "{\"userpass\":\"$userpass\",\"method\":\"orderbook\",\"base\":\"REVS\",\"rel\":\"KMD\"}"
curl --url "http://127.0.0.1:7782" --data "{\"userpass\":\"$userpass\",\"method\":\"orderbook\",\"base\":\"REVS\",\"rel\":\"KMD\"}"
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"orderbook\",\"base\":\"REVS\",\"rel\":\"KMD\"}" curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"orderbook\",\"base\":\"REVS\",\"rel\":\"KMD\"}"
curl --url "http://127.0.0.1:7783" --data "{\"userpass\":\"$userpass\",\"method\":\"orderbook\",\"base\":\"REVS\",\"rel\":\"KMD\"}"
curl --url "http://127.0.0.1:7783" --data "{\"queueid\":2,\"userpass\":\"$userpass\",\"method\":\"orderbook\",\"base\":\"REVS\",\"rel\":\"KMD\"}"

13
iguana/exchanges/stats.c

@ -629,10 +629,10 @@ int32_t iguana_getheadersize(char *buf,int32_t recvlen)
uint16_t RPC_port; uint16_t RPC_port;
extern portable_mutex_t LP_gcmutex; extern portable_mutex_t LP_gcmutex;
extern struct rpcrequest_info *LP_garbage_collector; extern struct rpcrequest_info *LP_garbage_collector;
static int32_t spawned,maxspawned;
void LP_rpc_processreq(void *_ptr) void LP_rpc_processreq(void *_ptr)
{ {
static uint32_t spawned,maxspawned;
char filetype[128],content_type[128]; char filetype[128],content_type[128];
int32_t recvlen,flag,postflag=0,contentlen,remains,sock,numsent,jsonflag=0,hdrsize,len; int32_t recvlen,flag,postflag=0,contentlen,remains,sock,numsent,jsonflag=0,hdrsize,len;
char helpname[512],remoteaddr[64],*buf,*retstr,space[8192],space2[32786],*jsonbuf; struct rpcrequest_info *req = _ptr; char helpname[512],remoteaddr[64],*buf,*retstr,space[8192],space2[32786],*jsonbuf; struct rpcrequest_info *req = _ptr;
@ -647,6 +647,8 @@ void LP_rpc_processreq(void *_ptr)
//printf("alloc jsonbuf.%p\n",jsonbuf); //printf("alloc jsonbuf.%p\n",jsonbuf);
remains = size-1; remains = size-1;
buf = jsonbuf; buf = jsonbuf;
if ( spawned < 0 )
spawned = 0;
spawned++; spawned++;
if ( spawned > maxspawned ) if ( spawned > maxspawned )
{ {
@ -796,7 +798,8 @@ void LP_rpc_processreq(void *_ptr)
//printf("free req.%p\n",req); //printf("free req.%p\n",req);
free(req); free(req);
} }
spawned--; if ( spawned > 0 )
spawned--;
} }
extern int32_t IAMLP,LP_STOP_RECEIVED; extern int32_t IAMLP,LP_STOP_RECEIVED;
@ -859,10 +862,10 @@ void stats_rpcloop(void *args)
req->sock = sock; req->sock = sock;
req->ipbits = ipbits; req->ipbits = ipbits;
req->port = port; req->port = port;
LP_rpc_processreq(req); if ( spawned > 1 )
continue; LP_rpc_processreq(req);
// this might lead to "cant open file errors" // this might lead to "cant open file errors"
if ( (retval= OS_thread_create(&req->T,NULL,(void *)LP_rpc_processreq,req)) != 0 ) else if ( (retval= OS_thread_create(&req->T,NULL,(void *)LP_rpc_processreq,req)) != 0 )
{ {
printf("error launching rpc handler on port %d, retval.%d\n",port,retval); printf("error launching rpc handler on port %d, retval.%d\n",port,retval);
LP_rpc_processreq(req); LP_rpc_processreq(req);

Loading…
Cancel
Save