mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 12:37:51 +02:00
stub sending of transactions to server
This commit is contained in:
parent
5b3b19011e
commit
ee67c64b76
3 changed files with 22 additions and 4 deletions
|
@ -59,11 +59,17 @@ DomainServer::DomainServer(int argc, char* argv[]) :
|
||||||
_networkAccessManager = new QNetworkAccessManager(this);
|
_networkAccessManager = new QNetworkAccessManager(this);
|
||||||
|
|
||||||
// setup a timer to send transactions to pay assigned nodes every 30 seconds
|
// setup a timer to send transactions to pay assigned nodes every 30 seconds
|
||||||
QTimer* nodePaymentTimer = new QTimer(this);
|
QTimer* creditSetupTimer = new QTimer(this);
|
||||||
connect(nodePaymentTimer, &QTimer::timeout, this, &DomainServer::setupPendingAssignmentCredits);
|
connect(creditSetupTimer, &QTimer::timeout, this, &DomainServer::setupPendingAssignmentCredits);
|
||||||
|
|
||||||
const qint64 CREDIT_CHECK_INTERVAL = 5 * 1000;
|
const qint64 CREDIT_CHECK_INTERVAL_MSECS = 5 * 1000;
|
||||||
nodePaymentTimer->start(CREDIT_CHECK_INTERVAL);
|
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) {
|
void DomainServer::processDatagram(const QByteArray& receivedPacket, const HifiSockAddr& senderSockAddr) {
|
||||||
LimitedNodeList* nodeList = LimitedNodeList::getInstance();
|
LimitedNodeList* nodeList = LimitedNodeList::getInstance();
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@ public slots:
|
||||||
private slots:
|
private slots:
|
||||||
void readAvailableDatagrams();
|
void readAvailableDatagrams();
|
||||||
void setupPendingAssignmentCredits();
|
void setupPendingAssignmentCredits();
|
||||||
|
void sendPendingTransactionsToServer();
|
||||||
private:
|
private:
|
||||||
void setupNodeListAndAssignments(const QUuid& sessionUUID = QUuid::createUuid());
|
void setupNodeListAndAssignments(const QUuid& sessionUUID = QUuid::createUuid());
|
||||||
bool optionallySetupOAuth();
|
bool optionallySetupOAuth();
|
||||||
|
|
|
@ -30,6 +30,7 @@ public:
|
||||||
void incrementAmount(double increment) { _amount += increment; }
|
void incrementAmount(double increment) { _amount += increment; }
|
||||||
|
|
||||||
bool isFinalized() const { return _isFinalized; }
|
bool isFinalized() const { return _isFinalized; }
|
||||||
|
void setIsFinalized(bool isFinalized) { _isFinalized = isFinalized; }
|
||||||
|
|
||||||
QJsonDocument postJson();
|
QJsonDocument postJson();
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Reference in a new issue