Showing the changes to interface/src/Application.cpp (1 of 2 files). Show all
Unified · Split
| @@ -2883,19 +2883,35 @@ void Application::displayStats() { · 2882 unmodified lines | ||
| 2883 | 2883 | drawtext(10, statsVerticalOffset + 15, 0.10f, 0, 1.0, 0, stats); |
| 2884 | 2884 | |
| 2885 | 2885 | if (_testPing->isChecked()) { |
| 2886 | − int pingAudio = 0, pingAvatar = 0, pingVoxel = 0; | |
| 2886 | + int pingAudio = 0, pingAvatar = 0, pingVoxel = 0, pingVoxelMax = 0; | |
| 2887 | 2887 | |
| 2888 | − NodeList *nodeList = NodeList::getInstance(); | |
| 2889 | − Node *audioMixerNode = nodeList->soloNodeOfType(NODE_TYPE_AUDIO_MIXER); | |
| 2890 | − Node *avatarMixerNode = nodeList->soloNodeOfType(NODE_TYPE_AVATAR_MIXER); | |
| 2891 | − Node *voxelServerNode = nodeList->soloNodeOfType(NODE_TYPE_VOXEL_SERVER); | |
| 2888 | + NodeList* nodeList = NodeList::getInstance(); | |
| 2889 | + Node* audioMixerNode = nodeList->soloNodeOfType(NODE_TYPE_AUDIO_MIXER); | |
| 2890 | + Node* avatarMixerNode = nodeList->soloNodeOfType(NODE_TYPE_AVATAR_MIXER); | |
| 2892 | 2891 | |
| 2893 | 2892 | pingAudio = audioMixerNode ? audioMixerNode->getPingMs() : 0; |
| 2894 | 2893 | pingAvatar = avatarMixerNode ? avatarMixerNode->getPingMs() : 0; |
| 2895 | − pingVoxel = voxelServerNode ? voxelServerNode->getPingMs() : 0; | |
| 2894 | + | |
| 2895 | + | |
| 2896 | + // Now handle voxel servers, since there could be more than one, we average their ping times | |
| 2897 | + unsigned long totalPingVoxel = 0; | |
| 2898 | + int voxelServerCount = 0; | |
| 2899 | + for (NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) { | |
| 2900 | + if (node->getType() == NODE_TYPE_VOXEL_SERVER) { | |
| 2901 | + totalPingVoxel += node->getPingMs(); | |
| 2902 | + voxelServerCount++; | |
| 2903 | + if (pingVoxelMax < node->getPingMs()) { | |
| 2904 | + pingVoxelMax = node->getPingMs(); | |
| 2905 | + } | |
| 2906 | + } | |
| 2907 | + } | |
| 2908 | + if (voxelServerCount) { | |
| 2909 | + pingVoxel = totalPingVoxel/voxelServerCount; | |
| 2910 | + } | |
| 2911 | + | |
| 2896 | 2912 | |
| 2897 | 2913 | char pingStats[200]; |
| 2898 | − sprintf(pingStats, "Ping audio/avatar/voxel: %d / %d / %d ", pingAudio, pingAvatar, pingVoxel); | |
| 2914 | + sprintf(pingStats, "Ping audio/avatar/voxel: %d / %d / %d avg %d max ", pingAudio, pingAvatar, pingVoxel, pingVoxelMax); | |
| 2899 | 2915 | drawtext(10, statsVerticalOffset + 35, 0.10f, 0, 1.0, 0, pingStats); |
| 2900 | 2916 | } |
| 2901 | 2917 | |
| @@ -3495,7 +3511,6 @@ void* Application::networkReceive(void* args) { · 593 unmodified lines | ||
| 3495 | 3511 | } // fall through to piggyback message |
| 3496 | 3512 | |
| 3497 | 3513 | if (app->_renderVoxels->isChecked()) { |
| 3498 | − //Node* voxelServer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_VOXEL_SERVER); | |
| 3499 | 3514 | Node* voxelServer = NodeList::getInstance()->nodeWithAddress(&senderAddress); |
| 3500 | 3515 | if (voxelServer && socketMatch(voxelServer->getActiveSocket(), &senderAddress)) { |
| 3501 | 3516 | voxelServer->lock(); |