Browse Source

Test

etomic
jl777 8 years ago
parent
commit
5157eef1d8
  1. 45
      iguana/exchanges/LP_socket.c

45
iguana/exchanges/LP_socket.c

@ -541,34 +541,37 @@ int32_t LP_recvfunc(struct electrum_info *ep,char *str,int32_t len)
} }
} }
idnum = juint(strjson,"id"); idnum = juint(strjson,"id");
portable_mutex_lock(&ep->pendingQ.mutex); if ( 0 ) // crashes cipi's node
if ( ep->pendingQ.list != 0 )
{ {
DL_FOREACH(ep->pendingQ.list,item) portable_mutex_lock(&ep->pendingQ.mutex);
if ( ep->pendingQ.list != 0 )
{ {
stritem = (struct stritem *)item; DL_FOREACH(ep->pendingQ.list,item)
if ( item->type == idnum )
{ {
//printf("matched idnum.%d\n",idnum); stritem = (struct stritem *)item;
DL_DELETE(ep->pendingQ.list,item); if ( item->type == idnum )
break; {
} //printf("matched idnum.%d\n",idnum);
if ( stritem->expiration < ep->lasttime ) DL_DELETE(ep->pendingQ.list,item);
{ break;
DL_DELETE(ep->pendingQ.list,item); }
printf("expired (%s)\n",stritem->str); if ( stritem->expiration < ep->lasttime )
if ( stritem->retptrp != 0 )
{ {
errjson = cJSON_CreateObject(); DL_DELETE(ep->pendingQ.list,item);
jaddnum(errjson,"id",item->type); printf("expired (%s)\n",stritem->str);
jaddstr(errjson,"error","timeout"); if ( stritem->retptrp != 0 )
*((cJSON **)stritem->retptrp) = errjson; {
}; errjson = cJSON_CreateObject();
jaddnum(errjson,"id",item->type);
jaddstr(errjson,"error","timeout");
*((cJSON **)stritem->retptrp) = errjson;
};
}
item = 0;
} }
item = 0;
} }
portable_mutex_unlock(&ep->pendingQ.mutex);
} }
portable_mutex_unlock(&ep->pendingQ.mutex);
if ( item != 0 ) if ( item != 0 )
{ {
// do callback // do callback

Loading…
Cancel
Save