/* List Node Test function */ void list_node_test(void) { Node_t *pList = NULL; elemType data[10] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; elemType *ret_data; initList(&pList); pList = createList(pList, data, 10L); printList(pList); lk_print("The size of pList: %ld.\n", sizeList(pList)); lk_print("getElement(pList, 4) = %d.\n", getElement(pList, 4)); ret_data = getDataFromList(pList, 4); lk_print("ret_data[4] = %d.\n", *ret_data); setDataByPosition(pList, 4, 0); printList(pList); insertHeadNode(&pList, 9); lk_print("The size of pList: %ld.\n", sizeList(pList)); printList(pList); insertLastNode(&pList, 0); printList(pList); lk_print("The size of pList: %ld.\n", sizeList(pList)); insertNodeByPosition(&pList, 14, 8); printList(pList); deleteNodeByPosition(&pList, 12); printList(pList); swapTwoNodeElemInList(&pList, 10, 10); printList(pList); clearList(pList); lk_print("done\n"); }
void SocketThread::sendPendingData() { while(listToSend.count()) { QByteArray dataToSend; getDataFromList(&listToSend,&dataToSend); checkSocketConnected(); sslSocket->write(dataToSend); sslSocket->waitForBytesWritten(); if(listToSend.count()>100)listToSend.clear(); } if(queryTime.elapsed()<200)return; if(sendState==0)sendToApiNow("BTC"+currencyStr+"/money/order/lag",""); else switch(sendState) { case 1: sendToApiNow("BTC"+currencyStr+"/money/info",""); break; case 2: sendToApiNow("BTC"+currencyStr+"/money/ticker",""); break; case 3: sendToApiNow("BTC"+currencyStr+"/money/orders",""); break; default: break; } if(++sendState>3)sendState=0; queryTime.restart(); }