mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-23 13:44:36 +02:00
voxel edit packet debugging support
This commit is contained in:
parent
b0a4ffb11c
commit
a75e577d0a
5 changed files with 24 additions and 13 deletions
|
@ -71,6 +71,7 @@ VoxelServer::VoxelServer(const unsigned char* dataBuffer, int numBytes) : Assign
|
||||||
_sendEnvironments = true;
|
_sendEnvironments = true;
|
||||||
_sendMinimalEnvironment = false;
|
_sendMinimalEnvironment = false;
|
||||||
_dumpVoxelsOnMove = false;
|
_dumpVoxelsOnMove = false;
|
||||||
|
_verboseDebug = false;
|
||||||
_jurisdiction = NULL;
|
_jurisdiction = NULL;
|
||||||
_jurisdictionSender = NULL;
|
_jurisdictionSender = NULL;
|
||||||
_voxelServerPacketProcessor = NULL;
|
_voxelServerPacketProcessor = NULL;
|
||||||
|
@ -427,14 +428,14 @@ void VoxelServer::run() {
|
||||||
|
|
||||||
// should we send environments? Default is yes, but this command line suppresses sending
|
// should we send environments? Default is yes, but this command line suppresses sending
|
||||||
const char* SEND_ENVIRONMENTS = "--sendEnvironments";
|
const char* SEND_ENVIRONMENTS = "--sendEnvironments";
|
||||||
bool dontSendEnvironments = !getCmdOption(_argc, _argv, SEND_ENVIRONMENTS);
|
bool dontSendEnvironments = !cmdOptionExists(_argc, _argv, SEND_ENVIRONMENTS);
|
||||||
if (dontSendEnvironments) {
|
if (dontSendEnvironments) {
|
||||||
qDebug("Sending environments suppressed...\n");
|
qDebug("Sending environments suppressed...\n");
|
||||||
_sendEnvironments = false;
|
_sendEnvironments = false;
|
||||||
} else {
|
} else {
|
||||||
// should we send environments? Default is yes, but this command line suppresses sending
|
// should we send environments? Default is yes, but this command line suppresses sending
|
||||||
const char* MINIMAL_ENVIRONMENT = "--minimalEnvironment";
|
const char* MINIMAL_ENVIRONMENT = "--minimalEnvironment";
|
||||||
_sendMinimalEnvironment = getCmdOption(_argc, _argv, MINIMAL_ENVIRONMENT);
|
_sendMinimalEnvironment = cmdOptionExists(_argc, _argv, MINIMAL_ENVIRONMENT);
|
||||||
qDebug("Using Minimal Environment=%s\n", debug::valueOf(_sendMinimalEnvironment));
|
qDebug("Using Minimal Environment=%s\n", debug::valueOf(_sendMinimalEnvironment));
|
||||||
}
|
}
|
||||||
qDebug("Sending environments=%s\n", debug::valueOf(_sendEnvironments));
|
qDebug("Sending environments=%s\n", debug::valueOf(_sendEnvironments));
|
||||||
|
@ -455,24 +456,28 @@ void VoxelServer::run() {
|
||||||
srand((unsigned)time(0));
|
srand((unsigned)time(0));
|
||||||
|
|
||||||
const char* DISPLAY_VOXEL_STATS = "--displayVoxelStats";
|
const char* DISPLAY_VOXEL_STATS = "--displayVoxelStats";
|
||||||
_displayVoxelStats = getCmdOption(_argc, _argv, DISPLAY_VOXEL_STATS);
|
_displayVoxelStats = cmdOptionExists(_argc, _argv, DISPLAY_VOXEL_STATS);
|
||||||
qDebug("displayVoxelStats=%s\n", debug::valueOf(_displayVoxelStats));
|
qDebug("displayVoxelStats=%s\n", debug::valueOf(_displayVoxelStats));
|
||||||
|
|
||||||
|
const char* VERBOSE_DEBUG = "--verboseDebug";
|
||||||
|
_verboseDebug = cmdOptionExists(_argc, _argv, VERBOSE_DEBUG);
|
||||||
|
qDebug("verboseDebug=%s\n", debug::valueOf(_verboseDebug));
|
||||||
|
|
||||||
const char* DEBUG_VOXEL_SENDING = "--debugVoxelSending";
|
const char* DEBUG_VOXEL_SENDING = "--debugVoxelSending";
|
||||||
_debugVoxelSending = getCmdOption(_argc, _argv, DEBUG_VOXEL_SENDING);
|
_debugVoxelSending = cmdOptionExists(_argc, _argv, DEBUG_VOXEL_SENDING);
|
||||||
qDebug("debugVoxelSending=%s\n", debug::valueOf(_debugVoxelSending));
|
qDebug("debugVoxelSending=%s\n", debug::valueOf(_debugVoxelSending));
|
||||||
|
|
||||||
const char* DEBUG_VOXEL_RECEIVING = "--debugVoxelReceiving";
|
const char* DEBUG_VOXEL_RECEIVING = "--debugVoxelReceiving";
|
||||||
_debugVoxelReceiving = getCmdOption(_argc, _argv, DEBUG_VOXEL_RECEIVING);
|
_debugVoxelReceiving = cmdOptionExists(_argc, _argv, DEBUG_VOXEL_RECEIVING);
|
||||||
qDebug("debugVoxelReceiving=%s\n", debug::valueOf(_debugVoxelReceiving));
|
qDebug("debugVoxelReceiving=%s\n", debug::valueOf(_debugVoxelReceiving));
|
||||||
|
|
||||||
const char* WANT_ANIMATION_DEBUG = "--shouldShowAnimationDebug";
|
const char* WANT_ANIMATION_DEBUG = "--shouldShowAnimationDebug";
|
||||||
_shouldShowAnimationDebug = getCmdOption(_argc, _argv, WANT_ANIMATION_DEBUG);
|
_shouldShowAnimationDebug = cmdOptionExists(_argc, _argv, WANT_ANIMATION_DEBUG);
|
||||||
qDebug("shouldShowAnimationDebug=%s\n", debug::valueOf(_shouldShowAnimationDebug));
|
qDebug("shouldShowAnimationDebug=%s\n", debug::valueOf(_shouldShowAnimationDebug));
|
||||||
|
|
||||||
// By default we will voxel persist, if you want to disable this, then pass in this parameter
|
// By default we will voxel persist, if you want to disable this, then pass in this parameter
|
||||||
const char* NO_VOXEL_PERSIST = "--NoVoxelPersist";
|
const char* NO_VOXEL_PERSIST = "--NoVoxelPersist";
|
||||||
if (getCmdOption(_argc, _argv, NO_VOXEL_PERSIST)) {
|
if (cmdOptionExists(_argc, _argv, NO_VOXEL_PERSIST)) {
|
||||||
_wantVoxelPersist = false;
|
_wantVoxelPersist = false;
|
||||||
}
|
}
|
||||||
qDebug("wantVoxelPersist=%s\n", debug::valueOf(_wantVoxelPersist));
|
qDebug("wantVoxelPersist=%s\n", debug::valueOf(_wantVoxelPersist));
|
||||||
|
|
|
@ -40,6 +40,7 @@ public:
|
||||||
|
|
||||||
bool wantsDebugVoxelSending() const { return _debugVoxelSending; }
|
bool wantsDebugVoxelSending() const { return _debugVoxelSending; }
|
||||||
bool wantsDebugVoxelReceiving() const { return _debugVoxelReceiving; }
|
bool wantsDebugVoxelReceiving() const { return _debugVoxelReceiving; }
|
||||||
|
bool wantsVerboseDebug() const { return _verboseDebug; }
|
||||||
bool wantShowAnimationDebug() const { return _shouldShowAnimationDebug; }
|
bool wantShowAnimationDebug() const { return _shouldShowAnimationDebug; }
|
||||||
bool wantSendEnvironments() const { return _sendEnvironments; }
|
bool wantSendEnvironments() const { return _sendEnvironments; }
|
||||||
bool wantDumpVoxelsOnMove() const { return _dumpVoxelsOnMove; }
|
bool wantDumpVoxelsOnMove() const { return _dumpVoxelsOnMove; }
|
||||||
|
@ -76,6 +77,7 @@ private:
|
||||||
bool _sendEnvironments;
|
bool _sendEnvironments;
|
||||||
bool _sendMinimalEnvironment;
|
bool _sendMinimalEnvironment;
|
||||||
bool _dumpVoxelsOnMove;
|
bool _dumpVoxelsOnMove;
|
||||||
|
bool _verboseDebug;
|
||||||
JurisdictionMap* _jurisdiction;
|
JurisdictionMap* _jurisdiction;
|
||||||
JurisdictionSender* _jurisdictionSender;
|
JurisdictionSender* _jurisdictionSender;
|
||||||
VoxelServerPacketProcessor* _voxelServerPacketProcessor;
|
VoxelServerPacketProcessor* _voxelServerPacketProcessor;
|
||||||
|
|
|
@ -24,10 +24,10 @@ VoxelServerPacketProcessor::VoxelServerPacketProcessor(VoxelServer* myServer) :
|
||||||
|
|
||||||
void VoxelServerPacketProcessor::processPacket(sockaddr& senderAddress, unsigned char* packetData, ssize_t packetLength) {
|
void VoxelServerPacketProcessor::processPacket(sockaddr& senderAddress, unsigned char* packetData, ssize_t packetLength) {
|
||||||
|
|
||||||
bool debugProcessPacket = _myServer->wantsDebugVoxelReceiving();
|
bool debugProcessPacket = _myServer->wantsVerboseDebug();
|
||||||
|
|
||||||
if (debugProcessPacket) {
|
if (debugProcessPacket) {
|
||||||
printf("VoxelServerPacketProcessor::processPacket(() packetData=%p packetLength=%ld\n", packetData, packetLength);
|
printf("VoxelServerPacketProcessor::processPacket() packetData=%p packetLength=%ld\n", packetData, packetLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
int numBytesPacketHeader = numBytesForPacketHeader(packetData);
|
int numBytesPacketHeader = numBytesForPacketHeader(packetData);
|
||||||
|
@ -58,7 +58,7 @@ void VoxelServerPacketProcessor::processPacket(sockaddr& senderAddress, unsigned
|
||||||
int maxSize = packetLength - atByte;
|
int maxSize = packetLength - atByte;
|
||||||
|
|
||||||
if (debugProcessPacket) {
|
if (debugProcessPacket) {
|
||||||
printf("VoxelServerPacketProcessor::processPacket(() %s packetData=%p packetLength=%ld voxelData=%p atByte=%d maxSize=%d\n",
|
printf("VoxelServerPacketProcessor::processPacket() %s packetData=%p packetLength=%ld voxelData=%p atByte=%d maxSize=%d\n",
|
||||||
destructive ? "PACKET_TYPE_SET_VOXEL_DESTRUCTIVE" : "PACKET_TYPE_SET_VOXEL",
|
destructive ? "PACKET_TYPE_SET_VOXEL_DESTRUCTIVE" : "PACKET_TYPE_SET_VOXEL",
|
||||||
packetData, packetLength, voxelData, atByte, maxSize);
|
packetData, packetLength, voxelData, atByte, maxSize);
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ void VoxelServerPacketProcessor::processPacket(sockaddr& senderAddress, unsigned
|
||||||
}
|
}
|
||||||
|
|
||||||
if (debugProcessPacket) {
|
if (debugProcessPacket) {
|
||||||
printf("VoxelServerPacketProcessor::processPacket(() DONE LOOPING FOR %s packetData=%p packetLength=%ld voxelData=%p atByte=%d\n",
|
printf("VoxelServerPacketProcessor::processPacket() DONE LOOPING FOR %s packetData=%p packetLength=%ld voxelData=%p atByte=%d\n",
|
||||||
destructive ? "PACKET_TYPE_SET_VOXEL_DESTRUCTIVE" : "PACKET_TYPE_SET_VOXEL",
|
destructive ? "PACKET_TYPE_SET_VOXEL_DESTRUCTIVE" : "PACKET_TYPE_SET_VOXEL",
|
||||||
packetData, packetLength, voxelData, atByte);
|
packetData, packetLength, voxelData, atByte);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,8 @@ VoxelEditPacketSender::VoxelEditPacketSender(PacketSenderNotify* notify) :
|
||||||
_shouldSend(true),
|
_shouldSend(true),
|
||||||
_maxPendingMessages(DEFAULT_MAX_PENDING_MESSAGES),
|
_maxPendingMessages(DEFAULT_MAX_PENDING_MESSAGES),
|
||||||
_releaseQueuedMessagesPending(false),
|
_releaseQueuedMessagesPending(false),
|
||||||
_voxelServerJurisdictions(NULL) {
|
_voxelServerJurisdictions(NULL),
|
||||||
|
_sequenceNumber(0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
VoxelEditPacketSender::~VoxelEditPacketSender() {
|
VoxelEditPacketSender::~VoxelEditPacketSender() {
|
||||||
|
@ -274,7 +275,8 @@ void VoxelEditPacketSender::releaseQueuedPacket(EditPacketBuffer& packetBuffer)
|
||||||
void VoxelEditPacketSender::initializePacket(EditPacketBuffer& packetBuffer, PACKET_TYPE type) {
|
void VoxelEditPacketSender::initializePacket(EditPacketBuffer& packetBuffer, PACKET_TYPE type) {
|
||||||
packetBuffer._currentSize = populateTypeAndVersion(&packetBuffer._currentBuffer[0], type);
|
packetBuffer._currentSize = populateTypeAndVersion(&packetBuffer._currentBuffer[0], type);
|
||||||
unsigned short int* sequenceAt = (unsigned short int*)&packetBuffer._currentBuffer[packetBuffer._currentSize];
|
unsigned short int* sequenceAt = (unsigned short int*)&packetBuffer._currentBuffer[packetBuffer._currentSize];
|
||||||
*sequenceAt = 0;
|
*sequenceAt = _sequenceNumber;
|
||||||
|
_sequenceNumber++;
|
||||||
packetBuffer._currentSize += sizeof(unsigned short int); // set to command + sequence
|
packetBuffer._currentSize += sizeof(unsigned short int); // set to command + sequence
|
||||||
packetBuffer._currentType = type;
|
packetBuffer._currentType = type;
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,5 +105,7 @@ private:
|
||||||
std::vector<EditPacketBuffer*> _preServerSingleMessagePackets; // these will go out as is
|
std::vector<EditPacketBuffer*> _preServerSingleMessagePackets; // these will go out as is
|
||||||
|
|
||||||
NodeToJurisdictionMap* _voxelServerJurisdictions;
|
NodeToJurisdictionMap* _voxelServerJurisdictions;
|
||||||
|
|
||||||
|
unsigned short int _sequenceNumber;
|
||||||
};
|
};
|
||||||
#endif // __shared__VoxelEditPacketSender__
|
#endif // __shared__VoxelEditPacketSender__
|
||||||
|
|
Loading…
Reference in a new issue