refactor ping packet sending to push past version byte

This commit is contained in:
Stephen Birarda 2013-07-11 12:42:45 -07:00
parent 94b25a18aa
commit b201d13e31

View file

@ -904,15 +904,15 @@ void Application::wheelEvent(QWheelEvent* event) {
void Application::sendPingPackets() { void Application::sendPingPackets() {
char nodeTypesOfInterest[] = {NODE_TYPE_VOXEL_SERVER, NODE_TYPE_AUDIO_MIXER, NODE_TYPE_AVATAR_MIXER}; const char nodesToPing[] = {NODE_TYPE_VOXEL_SERVER, NODE_TYPE_AUDIO_MIXER, NODE_TYPE_AVATAR_MIXER};
uint64_t currentTime = usecTimestampNow(); uint64_t currentTime = usecTimestampNow();
unsigned char pingPacket[numBytesForPacketHeader((unsigned char*) &PACKET_TYPE_PING) + sizeof(currentTime)]; unsigned char pingPacket[numBytesForPacketHeader((unsigned char*) &PACKET_TYPE_PING) + sizeof(currentTime)];
int numHeaderBytes = populateTypeAndVersion(pingPacket, PACKET_TYPE_PING); int numHeaderBytes = populateTypeAndVersion(pingPacket, PACKET_TYPE_PING);
memcpy(&pingPacket[1], &currentTime, sizeof(currentTime)); memcpy(pingPacket + numHeaderBytes, &currentTime, sizeof(currentTime));
getInstance()->controlledBroadcastToNodes(pingPacket, numHeaderBytes + sizeof(currentTime), getInstance()->controlledBroadcastToNodes(pingPacket, sizeof(pingPacket),
nodeTypesOfInterest, sizeof(nodeTypesOfInterest)); nodesToPing, sizeof(nodesToPing));
} }
// Every second, check the frame rates and other stuff // Every second, check the frame rates and other stuff