stub sending of transactions to server

This commit is contained in:
Stephen Birarda 2014-05-21 09:26:17 -07:00
parent 5b3b19011e
commit ee67c64b76
3 changed files with 22 additions and 4 deletions

View file

@ -59,11 +59,17 @@ DomainServer::DomainServer(int argc, char* argv[]) :
_networkAccessManager = new QNetworkAccessManager(this);
// setup a timer to send transactions to pay assigned nodes every 30 seconds
QTimer* nodePaymentTimer = new QTimer(this);
connect(nodePaymentTimer, &QTimer::timeout, this, &DomainServer::setupPendingAssignmentCredits);
QTimer* creditSetupTimer = new QTimer(this);
connect(creditSetupTimer, &QTimer::timeout, this, &DomainServer::setupPendingAssignmentCredits);
const qint64 CREDIT_CHECK_INTERVAL = 5 * 1000;
nodePaymentTimer->start(CREDIT_CHECK_INTERVAL);
const qint64 CREDIT_CHECK_INTERVAL_MSECS = 5 * 1000;
creditSetupTimer->start(CREDIT_CHECK_INTERVAL_MSECS);
QTimer* nodePaymentTimer = new QTimer(this);
connect(nodePaymentTimer, &QTimer::timeout, this, &DomainServer::sendPendingTransactionsToServer);
const qint64 TRANSACTION_SEND_INTERVAL_MSECS = 30 * 1000;
nodePaymentTimer->start(TRANSACTION_SEND_INTERVAL_MSECS);
}
}
@ -694,6 +700,16 @@ void DomainServer::setupPendingAssignmentCredits() {
}
}
void DomainServer::sendPendingTransactionsToServer() {
// enumerate the pending transactions and send them to the server to complete payment
TransactionHash::iterator i = _pendingAssignmentCredits.begin();
while (i != _pendingAssignmentCredits.end()) {
++i;
}
}
void DomainServer::processDatagram(const QByteArray& receivedPacket, const HifiSockAddr& senderSockAddr) {
LimitedNodeList* nodeList = LimitedNodeList::getInstance();

View file

@ -50,6 +50,7 @@ public slots:
private slots:
void readAvailableDatagrams();
void setupPendingAssignmentCredits();
void sendPendingTransactionsToServer();
private:
void setupNodeListAndAssignments(const QUuid& sessionUUID = QUuid::createUuid());
bool optionallySetupOAuth();

View file

@ -30,6 +30,7 @@ public:
void incrementAmount(double increment) { _amount += increment; }
bool isFinalized() const { return _isFinalized; }
void setIsFinalized(bool isFinalized) { _isFinalized = isFinalized; }
QJsonDocument postJson();
private: