mirror of
https://github.com/overte-org/overte.git
synced 2025-08-07 14:30:35 +02:00
Merge pull request #1128 from birarda/master
pay attention to jurisdictions, run the silent node removal thread in the agent
This commit is contained in:
commit
8cbf5a88e5
4 changed files with 25 additions and 3 deletions
|
@ -143,6 +143,8 @@ void Agent::run() {
|
||||||
|
|
||||||
int thisFrame = 0;
|
int thisFrame = 0;
|
||||||
|
|
||||||
|
NodeList::getInstance()->startSilentNodeRemovalThread();
|
||||||
|
|
||||||
while (!_shouldStop) {
|
while (!_shouldStop) {
|
||||||
|
|
||||||
// if we're not hearing from the domain-server we should stop running
|
// if we're not hearing from the domain-server we should stop running
|
||||||
|
@ -201,9 +203,17 @@ void Agent::run() {
|
||||||
|
|
||||||
while (NodeList::getInstance()->getNodeSocket()->receive((sockaddr*) &senderAddress, receivedData, &receivedBytes)
|
while (NodeList::getInstance()->getNodeSocket()->receive((sockaddr*) &senderAddress, receivedData, &receivedBytes)
|
||||||
&& packetVersionMatch(receivedData)) {
|
&& packetVersionMatch(receivedData)) {
|
||||||
NodeList::getInstance()->processNodeData((sockaddr*) &senderAddress, receivedData, receivedBytes);
|
if (receivedData[0] == PACKET_TYPE_VOXEL_JURISDICTION) {
|
||||||
|
voxelScripter.getJurisdictionListener()->queueReceivedPacket((sockaddr&) senderAddress,
|
||||||
|
receivedData,
|
||||||
|
receivedBytes);
|
||||||
|
} else {
|
||||||
|
NodeList::getInstance()->processNodeData((sockaddr*) &senderAddress, receivedData, receivedBytes);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NodeList::getInstance()->stopSilentNodeRemovalThread();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// error in curl_easy_perform
|
// error in curl_easy_perform
|
||||||
|
|
|
@ -8,6 +8,11 @@
|
||||||
|
|
||||||
#include "VoxelScriptingInterface.h"
|
#include "VoxelScriptingInterface.h"
|
||||||
|
|
||||||
|
VoxelScriptingInterface::VoxelScriptingInterface() {
|
||||||
|
_jurisdictionListener.initialize(true);
|
||||||
|
_voxelPacketSender.setVoxelServerJurisdictions(_jurisdictionListener.getJurisdictions());
|
||||||
|
}
|
||||||
|
|
||||||
void VoxelScriptingInterface::queueVoxelAdd(PACKET_TYPE addPacketType, VoxelDetail& addVoxelDetails) {
|
void VoxelScriptingInterface::queueVoxelAdd(PACKET_TYPE addPacketType, VoxelDetail& addVoxelDetails) {
|
||||||
_voxelPacketSender.queueVoxelEditMessages(addPacketType, 1, &addVoxelDetails);
|
_voxelPacketSender.queueVoxelEditMessages(addPacketType, 1, &addVoxelDetails);
|
||||||
}
|
}
|
||||||
|
@ -35,4 +40,4 @@ void VoxelScriptingInterface::queueVoxelDelete(float x, float y, float z, float
|
||||||
VoxelDetail deleteVoxelDetail = {x, y, z, scale, 0, 0, 0};
|
VoxelDetail deleteVoxelDetail = {x, y, z, scale, 0, 0, 0};
|
||||||
|
|
||||||
_voxelPacketSender.queueVoxelEditMessages(PACKET_TYPE_ERASE_VOXEL, 1, &deleteVoxelDetail);
|
_voxelPacketSender.queueVoxelEditMessages(PACKET_TYPE_ERASE_VOXEL, 1, &deleteVoxelDetail);
|
||||||
}
|
}
|
|
@ -11,13 +11,17 @@
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
|
|
||||||
|
#include <JurisdictionListener.h>
|
||||||
#include <VoxelEditPacketSender.h>
|
#include <VoxelEditPacketSender.h>
|
||||||
|
|
||||||
/// handles scripting of voxel commands from JS passed to assigned clients
|
/// handles scripting of voxel commands from JS passed to assigned clients
|
||||||
class VoxelScriptingInterface : public QObject {
|
class VoxelScriptingInterface : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
VoxelScriptingInterface();
|
||||||
|
|
||||||
VoxelEditPacketSender* getVoxelPacketSender() { return &_voxelPacketSender; }
|
VoxelEditPacketSender* getVoxelPacketSender() { return &_voxelPacketSender; }
|
||||||
|
JurisdictionListener* getJurisdictionListener() { return &_jurisdictionListener; }
|
||||||
public slots:
|
public slots:
|
||||||
/// queues the creation of a voxel which will be sent by calling process on the PacketSender
|
/// queues the creation of a voxel which will be sent by calling process on the PacketSender
|
||||||
/// \param x the x-coordinate of the voxel (in VS space)
|
/// \param x the x-coordinate of the voxel (in VS space)
|
||||||
|
@ -48,6 +52,7 @@ public slots:
|
||||||
private:
|
private:
|
||||||
/// attached VoxelEditPacketSender that handles queuing and sending of packets to VS
|
/// attached VoxelEditPacketSender that handles queuing and sending of packets to VS
|
||||||
VoxelEditPacketSender _voxelPacketSender;
|
VoxelEditPacketSender _voxelPacketSender;
|
||||||
|
JurisdictionListener _jurisdictionListener;
|
||||||
|
|
||||||
void queueVoxelAdd(PACKET_TYPE addPacketType, VoxelDetail& addVoxelDetails);
|
void queueVoxelAdd(PACKET_TYPE addPacketType, VoxelDetail& addVoxelDetails);
|
||||||
};
|
};
|
||||||
|
|
|
@ -74,8 +74,10 @@ bool PacketSender::process() {
|
||||||
// we can determine how many packets we need to send per call to achieve our desired
|
// we can determine how many packets we need to send per call to achieve our desired
|
||||||
// packets per second send rate.
|
// packets per second send rate.
|
||||||
int callsPerSecond = USECS_PER_SECOND / averageCallTime;
|
int callsPerSecond = USECS_PER_SECOND / averageCallTime;
|
||||||
|
|
||||||
// make sure our number of calls per second doesn't cause a divide by zero
|
// make sure our number of calls per second doesn't cause a divide by zero
|
||||||
glm::clamp(callsPerSecond, 1, _packetsPerSecond);
|
callsPerSecond = glm::clamp(callsPerSecond, 1, _packetsPerSecond);
|
||||||
|
|
||||||
packetsPerCall = ceil(_packetsPerSecond / callsPerSecond);
|
packetsPerCall = ceil(_packetsPerSecond / callsPerSecond);
|
||||||
|
|
||||||
// send at least one packet per call, if we have it
|
// send at least one packet per call, if we have it
|
||||||
|
|
Loading…
Reference in a new issue