add forced kill of AS for test

This commit is contained in:
Stephen Birarda 2016-10-12 15:27:43 -07:00
parent 5704335b66
commit 27617b8479
4 changed files with 21 additions and 0 deletions

View file

@ -19,6 +19,8 @@
#include <QtScript/QScriptEngine>
#include <QtNetwork/QNetworkDiskCache>
#include "udt/ControlPacket.h"
#include "AssetRequest.h"
#include "AssetUpload.h"
#include "AssetUtils.h"

View file

@ -32,6 +32,7 @@
#include <UUID.h>
#include "AccountManager.h"
#include "AssetClient.h"
#include "Assignment.h"
#include "HifiSockAddr.h"
#include "NetworkLogging.h"

View file

@ -28,6 +28,7 @@
#include "HifiSockAddr.h"
#include "NetworkLogging.h"
#include "udt/ControlPacket.h"
#include "udt/PacketHeaders.h"
#include "SharedUtil.h"
@ -125,6 +126,21 @@ 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) {

View file

@ -114,6 +114,8 @@ 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