Просмотр исходного кода

Eliminated the medium message priority to avoid synchronization problems where update messages would be sent after a node's or component's removal.

Lasse Öörni 14 лет назад
Родитель
Сommit
68beb82607
3 измененных файлов с 5 добавлено и 8 удалено
  1. 0 1
      Engine/Engine/NetworkAPI.cpp
  2. 5 5
      Engine/Network/Connection.cpp
  3. 0 2
      Engine/Network/Protocol.h

+ 0 - 1
Engine/Engine/NetworkAPI.cpp

@@ -72,7 +72,6 @@ void SendRemoteNodeEvent(Node* receiver, const String& eventType, bool inOrder,
 static void RegisterConnection(asIScriptEngine* engine)
 {
     engine->RegisterGlobalProperty("uint NET_LOW_PRIORITY", (void*)&NET_LOW_PRIORITY);
-    engine->RegisterGlobalProperty("uint NET_MEDIUM_PRIORITY", (void*)&NET_MEDIUM_PRIORITY);
     engine->RegisterGlobalProperty("uint NET_HIGH_PRIORITY", (void*)&NET_HIGH_PRIORITY);
     
     RegisterObject<Connection>(engine, "Connection");

+ 5 - 5
Engine/Network/Connection.cpp

@@ -264,7 +264,7 @@ void Connection::SendClientUpdate()
     msg_.WriteFloat(controls_.pitch_);
     msg_.WriteVariantMap(controls_.extraData_);
     msg_.WriteVector3(position_);
-    SendMessage(MSG_CONTROLS, false, false, msg_, NET_MEDIUM_PRIORITY, CONTROLS_CONTENT_ID);
+    SendMessage(MSG_CONTROLS, false, false, msg_, NET_HIGH_PRIORITY, CONTROLS_CONTENT_ID);
 }
 
 void Connection::SendRemoteEvents()
@@ -1083,7 +1083,7 @@ void Connection::ProcessExistingNode(Node* node)
             msg_.WriteVariant(j->second_);
         }
         
-        SendMessage(MSG_NODEDELTAUPDATE, true, true, msg_, NET_MEDIUM_PRIORITY);
+        SendMessage(MSG_NODEDELTAUPDATE, true, true, msg_, NET_HIGH_PRIORITY);
     }
     
     // Send latestdata message if necessary
@@ -1094,7 +1094,7 @@ void Connection::ProcessExistingNode(Node* node)
         msg_.WriteVLE(node->GetID());
         node->WriteLatestDataUpdate(msg_, nodeState.attributes_);
         
-        SendMessage(MSG_NODELATESTDATA, true, false, msg_, NET_MEDIUM_PRIORITY, node->GetID());
+        SendMessage(MSG_NODELATESTDATA, true, false, msg_, NET_HIGH_PRIORITY, node->GetID());
     }
     
     // Check for new or changed components
@@ -1138,7 +1138,7 @@ void Connection::ProcessExistingNode(Node* node)
                 msg_.WriteVLE(component->GetID());
                 component->WriteDeltaUpdate(msg_, deltaUpdateBits_, componentState.attributes_);
                 
-                SendMessage(MSG_COMPONENTDELTAUPDATE, true, true, msg_, NET_MEDIUM_PRIORITY);
+                SendMessage(MSG_COMPONENTDELTAUPDATE, true, true, msg_, NET_HIGH_PRIORITY);
             }
             
             // Send latestdata message if necessary
@@ -1149,7 +1149,7 @@ void Connection::ProcessExistingNode(Node* node)
                 msg_.WriteVLE(component->GetID());
                 component->WriteLatestDataUpdate(msg_, componentState.attributes_);
                 
-                SendMessage(MSG_COMPONENTLATESTDATA, true, false, msg_, NET_MEDIUM_PRIORITY, component->GetID());
+                SendMessage(MSG_COMPONENTLATESTDATA, true, false, msg_, NET_HIGH_PRIORITY, component->GetID());
             }
         }
     }

+ 0 - 2
Engine/Network/Protocol.h

@@ -66,7 +66,5 @@ static const unsigned CONTROLS_CONTENT_ID = 1;
 static const unsigned PACKAGE_FRAGMENT_SIZE = 1024;
 // Message high priority
 static const unsigned NET_HIGH_PRIORITY = 100;
-// Message medium priority
-static const unsigned NET_MEDIUM_PRIORITY = 50;
 // Message low priority (default)
 static const unsigned NET_LOW_PRIORITY = 0;