mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
make faked handshake request usable in dev/PR
This commit is contained in:
parent
ea2da34bd1
commit
b81eaa649f
7 changed files with 26 additions and 20 deletions
|
@ -19,8 +19,6 @@
|
|||
#include <QtScript/QScriptEngine>
|
||||
#include <QtNetwork/QNetworkDiskCache>
|
||||
|
||||
#include "udt/ControlPacket.h"
|
||||
|
||||
#include "AssetRequest.h"
|
||||
#include "AssetUpload.h"
|
||||
#include "AssetUtils.h"
|
||||
|
|
|
@ -1154,3 +1154,12 @@ void LimitedNodeList::clientConnectionToSockAddrReset(const HifiSockAddr& sockAd
|
|||
emit clientConnectionToNodeReset(matchingNode);
|
||||
}
|
||||
}
|
||||
|
||||
void LimitedNodeList::sendFakedHandshakeRequestToNode(SharedNodePointer node) {
|
||||
|
||||
if (node && node->getActiveSocket()) {
|
||||
// randomly send a handshake request packet to get assets we previously asked for into a stuck state
|
||||
auto handshakeRequestPacket = udt::ControlPacket::create(udt::ControlPacket::HandshakeRequest, 0);
|
||||
_nodeSocket.writeBasePacket(*handshakeRequestPacket, *node->getActiveSocket());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include "NLPacketList.h"
|
||||
#include "PacketReceiver.h"
|
||||
#include "ReceivedMessage.h"
|
||||
#include "udt/ControlPacket.h"
|
||||
#include "udt/PacketHeaders.h"
|
||||
#include "udt/Socket.h"
|
||||
#include "UUIDHasher.h"
|
||||
|
@ -235,6 +236,7 @@ public:
|
|||
|
||||
static void makeSTUNRequestPacket(char* stunRequestPacket);
|
||||
|
||||
void sendFakedHandshakeRequestToNode(SharedNodePointer node);
|
||||
|
||||
public slots:
|
||||
void reset();
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include "HifiSockAddr.h"
|
||||
|
||||
#include "NetworkLogging.h"
|
||||
#include "udt/ControlPacket.h"
|
||||
#include "udt/PacketHeaders.h"
|
||||
#include "SharedUtil.h"
|
||||
|
||||
|
@ -126,21 +125,6 @@ NodeList::NodeList(char newOwnerType, int socketListenPort, int dtlsListenPort)
|
|||
packetReceiver.registerListener(PacketType::ICEPingReply, &_domainHandler, "processICEPingReplyPacket");
|
||||
packetReceiver.registerListener(PacketType::DomainServerPathResponse, this, "processDomainServerPathResponse");
|
||||
packetReceiver.registerListener(PacketType::DomainServerRemovedNode, this, "processDomainServerRemovedNode");
|
||||
|
||||
// setup a timer to occasionally delete the AssetServer node - hopefully to help repro a specific stuck asset case
|
||||
auto killASTimer = new QTimer(this);
|
||||
connect(killASTimer, &QTimer::timeout, this, &NodeList::fakeHandshakeReq);
|
||||
killASTimer->start(10000);
|
||||
}
|
||||
|
||||
void NodeList::fakeHandshakeReq() {
|
||||
SharedNodePointer assetServer = soloNodeOfType(NodeType::AssetServer);
|
||||
|
||||
if (assetServer && assetServer->getActiveSocket()) {
|
||||
// randomly send a handshake request packet to get assets we previously asked for into a stuck state
|
||||
auto handshakeRequestPacket = udt::ControlPacket::create(udt::ControlPacket::HandshakeRequest, 0);
|
||||
_nodeSocket.writeBasePacket(*handshakeRequestPacket, *assetServer->getActiveSocket());
|
||||
}
|
||||
}
|
||||
|
||||
qint64 NodeList::sendStats(const QJsonObject& statsObject, const HifiSockAddr& destination) {
|
||||
|
|
|
@ -114,8 +114,6 @@ private slots:
|
|||
void sendKeepAlivePings();
|
||||
|
||||
void maybeSendIgnoreSetToNode(SharedNodePointer node);
|
||||
|
||||
void fakeHandshakeReq();
|
||||
|
||||
private:
|
||||
NodeList() : LimitedNodeList(INVALID_PORT, INVALID_PORT) { assert(false); } // Not implemented, needed for DependencyManager templates compile
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include <AssetUpload.h>
|
||||
#include <MappingRequest.h>
|
||||
#include <NetworkLogging.h>
|
||||
#include <NodeList.h>
|
||||
|
||||
AssetScriptingInterface::AssetScriptingInterface(QScriptEngine* engine) :
|
||||
_engine(engine)
|
||||
|
@ -86,3 +87,13 @@ void AssetScriptingInterface::downloadData(QString urlString, QScriptValue callb
|
|||
|
||||
assetRequest->start();
|
||||
}
|
||||
|
||||
#if (PR_BUILD || DEV_BUILD)
|
||||
void AssetScriptingInterface::sendFakedHandshake() {
|
||||
auto nodeList = DependencyManager::get<NodeList>();
|
||||
SharedNodePointer assetServer = nodeList->soloNodeOfType(NodeType::AssetServer);
|
||||
|
||||
nodeList->sendFakedHandshakeRequestToNode(assetServer);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -28,6 +28,10 @@ public:
|
|||
Q_INVOKABLE void downloadData(QString url, QScriptValue downloadComplete);
|
||||
Q_INVOKABLE void setMapping(QString path, QString hash, QScriptValue callback);
|
||||
|
||||
#if (PR_BUILD || DEV_BUILD)
|
||||
Q_INVOKABLE void sendFakedHandshake();
|
||||
#endif
|
||||
|
||||
protected:
|
||||
QSet<AssetRequest*> _pendingRequests;
|
||||
QScriptEngine* _engine;
|
||||
|
|
Loading…
Reference in a new issue