Prechádzať zdrojové kódy

Remote event registration is checked only when receiving.

Lasse Öörni 11 rokov pred
rodič
commit
e9f0baa398
2 zmenil súbory, kde vykonal 1 pridanie a 13 odobranie
  1. 1 1
      Docs/Reference.dox
  2. 0 12
      Source/Engine/Network/Connection.cpp

+ 1 - 1
Docs/Reference.dox

@@ -2067,7 +2067,7 @@ A remote event consists of its event type (name hash), a flag that tells whether
 
 To send a remote event to a Connection, use its \ref Connection::SendRemoteEvent "SendRemoteEvent()" function. To broadcast remote events to several connections at once (server only), use Network's \ref Network::BroadcastRemoteEvent "BroadcastRemoteEvent()" function.
 
-For safety, allowed remote event types should be registered so that a client can not for example trigger an internal render update event on the server. See \ref Network::RegisterRemoteEvent "RegisterRemoteEvent()". Similarly to file paths, as long as no remote event types are registered, all are allowed.
+For safety, allowed remote event types should be registered so that a client can not for example trigger an internal render update event on the server. See \ref Network::RegisterRemoteEvent "RegisterRemoteEvent()". Similarly to file paths, as long as no remote event types are registered, all are allowed. The registration affects only receiving events; sending whatever event is always allowed.
 
 Like with ordinary events, in script event types are strings instead of name hashes for convenience.
 

+ 0 - 12
Source/Engine/Network/Connection.cpp

@@ -105,12 +105,6 @@ void Connection::SendMessage(int msgID, bool reliable, bool inOrder, const unsig
 
 void Connection::SendRemoteEvent(StringHash eventType, bool inOrder, const VariantMap& eventData)
 {
-    if (!GetSubsystem<Network>()->CheckRemoteEvent(eventType))
-    {
-        LOGWARNING("Discarding not allowed remote event " + eventType.ToString());
-        return;
-    }
-    
     RemoteEvent queuedEvent;
     queuedEvent.senderID_ = 0;
     queuedEvent.eventType_ = eventType;
@@ -121,12 +115,6 @@ void Connection::SendRemoteEvent(StringHash eventType, bool inOrder, const Varia
 
 void Connection::SendRemoteEvent(Node* node, StringHash eventType, bool inOrder, const VariantMap& eventData)
 {
-    if (!GetSubsystem<Network>()->CheckRemoteEvent(eventType))
-    {
-        LOGWARNING("Discarding not allowed remote event " + eventType.ToString());
-        return;
-    }
-    
     if (!node)
     {
         LOGERROR("Null sender node for remote node event");