History

support for multiple voxel servers in ping stats

ZappoMan committed 13 years ago

Commit 620fe121 parent 95e6fb12 files · +24 −9Browse files

Showing the changes to interface/src/Application.cpp (1 of 2 files). Show all

Unified · Split

interface/src/Application.cpp+23−8
@@ -2883,19 +2883,35 @@ void Application::displayStats() { · 2882 unmodified lines
2883 drawtext(10, statsVerticalOffset + 15, 0.10f, 0, 1.0, 0, stats);2883 drawtext(10, statsVerticalOffset + 15, 0.10f, 0, 1.0, 0, stats);
2884 2884
2885 if (_testPing->isChecked()) {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();2888 NodeList* nodeList = NodeList::getInstance();
2889 Node *audioMixerNode = nodeList->soloNodeOfType(NODE_TYPE_AUDIO_MIXER);2889 Node* audioMixerNode = nodeList->soloNodeOfType(NODE_TYPE_AUDIO_MIXER);
2890 Node *avatarMixerNode = nodeList->soloNodeOfType(NODE_TYPE_AVATAR_MIXER);2890 Node* avatarMixerNode = nodeList->soloNodeOfType(NODE_TYPE_AVATAR_MIXER);
2891 Node *voxelServerNode = nodeList->soloNodeOfType(NODE_TYPE_VOXEL_SERVER);
2892 2891
2893 pingAudio = audioMixerNode ? audioMixerNode->getPingMs() : 0;2892 pingAudio = audioMixerNode ? audioMixerNode->getPingMs() : 0;
2894 pingAvatar = avatarMixerNode ? avatarMixerNode->getPingMs() : 0;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 char pingStats[200];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 drawtext(10, statsVerticalOffset + 35, 0.10f, 0, 1.0, 0, pingStats);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 } // fall through to piggyback message3511 } // fall through to piggyback message
3496 3512
3497 if (app->_renderVoxels->isChecked()) {3513 if (app->_renderVoxels->isChecked()) {
3498 //Node* voxelServer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_VOXEL_SERVER);
3499 Node* voxelServer = NodeList::getInstance()->nodeWithAddress(&senderAddress);3514 Node* voxelServer = NodeList::getInstance()->nodeWithAddress(&senderAddress);
3500 if (voxelServer && socketMatch(voxelServer->getActiveSocket(), &senderAddress)) {3515 if (voxelServer && socketMatch(voxelServer->getActiveSocket(), &senderAddress)) {
3501 voxelServer->lock();3516 voxelServer->lock();

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t