mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
fix packet sending from VoxelScriptingInterface
This commit is contained in:
parent
182c69c7b8
commit
5143c68b91
5 changed files with 13 additions and 17 deletions
|
@ -127,9 +127,7 @@ void Agent::run() {
|
|||
|
||||
QCoreApplication::processEvents();
|
||||
|
||||
if (_voxelScriptingInterface.getVoxelPacketSender()->voxelServersExist()) {
|
||||
timeval thisSend = {};
|
||||
gettimeofday(&thisSend, NULL);
|
||||
if (_voxelScriptingInterface.getVoxelPacketSender()->voxelServersExist()) {
|
||||
// allow the scripter's call back to setup visual data
|
||||
emit willSendVisualDataCallback();
|
||||
|
||||
|
|
|
@ -74,7 +74,12 @@ void AssignmentClient::readPendingDatagrams() {
|
|||
senderSockAddr.getPortPointer()))
|
||||
&& packetVersionMatch(packetData)) {
|
||||
|
||||
if (packetData[0] == PACKET_TYPE_DEPLOY_ASSIGNMENT || packetData[0] == PACKET_TYPE_CREATE_ASSIGNMENT) {
|
||||
if (_currentAssignment) {
|
||||
// have the threaded current assignment handle this datagram
|
||||
QMetaObject::invokeMethod(_currentAssignment, "processDatagram", Qt::QueuedConnection,
|
||||
Q_ARG(const QByteArray&, QByteArray((char*) packetData, receivedBytes)),
|
||||
Q_ARG(const HifiSockAddr&, senderSockAddr));
|
||||
} else if (packetData[0] == PACKET_TYPE_DEPLOY_ASSIGNMENT || packetData[0] == PACKET_TYPE_CREATE_ASSIGNMENT) {
|
||||
|
||||
if (_currentAssignment) {
|
||||
qDebug() << "Dropping received assignment since we are currently running one.\n";
|
||||
|
@ -110,11 +115,6 @@ void AssignmentClient::readPendingDatagrams() {
|
|||
qDebug("Received a bad destination socket for assignment.\n");
|
||||
}
|
||||
}
|
||||
} else if (_currentAssignment) {
|
||||
// have the threaded current assignment handle this datagram
|
||||
QMetaObject::invokeMethod(_currentAssignment, "processDatagram", Qt::QueuedConnection,
|
||||
Q_ARG(const QByteArray&, QByteArray((char*) packetData, receivedBytes)),
|
||||
Q_ARG(const HifiSockAddr&, senderSockAddr));
|
||||
} else {
|
||||
// have the NodeList attempt to handle it
|
||||
nodeList->processNodeData(senderSockAddr, packetData, receivedBytes);
|
||||
|
|
|
@ -27,13 +27,11 @@ void VoxelScriptingInterface::queueVoxelAdd(float x, float y, float z, float sca
|
|||
|
||||
void VoxelScriptingInterface::queueDestructiveVoxelAdd(float x, float y, float z, float scale,
|
||||
uchar red, uchar green, uchar blue) {
|
||||
// // setup a VoxelDetail struct with the data
|
||||
// VoxelDetail addVoxelDetail = {x, y, z, scale, red, green, blue};
|
||||
//
|
||||
// // queue the destructive add
|
||||
// queueVoxelAdd(PACKET_TYPE_SET_VOXEL_DESTRUCTIVE, addVoxelDetail);
|
||||
// setup a VoxelDetail struct with the data
|
||||
VoxelDetail addVoxelDetail = {x, y, z, scale, red, green, blue};
|
||||
|
||||
_voxelTree.createVoxel(x, y, z, scale, red, green, blue);
|
||||
// queue the destructive add
|
||||
queueVoxelAdd(PACKET_TYPE_SET_VOXEL_DESTRUCTIVE, addVoxelDetail);
|
||||
}
|
||||
|
||||
void VoxelScriptingInterface::queueVoxelDelete(float x, float y, float z, float scale) {
|
||||
|
|
|
@ -523,13 +523,12 @@ void VoxelServer::processDatagram(const QByteArray& dataByteArray, const HifiSoc
|
|||
uint64_t sentAt = (*((uint64_t*)(dataByteArray.data() + numBytesPacketHeader + sizeof(sequence))));
|
||||
uint64_t arrivedAt = usecTimestampNow();
|
||||
uint64_t transitTime = arrivedAt - sentAt;
|
||||
if (wantShowAnimationDebug() || wantsDebugVoxelReceiving()) {
|
||||
if (true) {
|
||||
printf("RECEIVE THREAD: got %s - command from client receivedBytes=%d sequence=%d transitTime=%llu usecs\n",
|
||||
messageName,
|
||||
dataByteArray.size(), sequence, transitTime);
|
||||
}
|
||||
}
|
||||
|
||||
_voxelServerPacketProcessor->queueReceivedPacket(senderSockAddr,
|
||||
(unsigned char*) dataByteArray.data(), dataByteArray.size());
|
||||
} else {
|
||||
|
|
|
@ -313,6 +313,7 @@ void VoxelEditPacketSender::releaseQueuedMessages() {
|
|||
|
||||
void VoxelEditPacketSender::releaseQueuedPacket(EditPacketBuffer& packetBuffer) {
|
||||
if (packetBuffer._currentSize > 0 && packetBuffer._currentType != PACKET_TYPE_UNKNOWN) {
|
||||
qDebug() << "queueing packet to node\n";
|
||||
queuePacketToNode(packetBuffer._nodeUUID, &packetBuffer._currentBuffer[0], packetBuffer._currentSize);
|
||||
}
|
||||
packetBuffer._currentSize = 0;
|
||||
|
|
Loading…
Reference in a new issue