Advertisement
Tsaukpaetra

UE4 Double Times for network stateless connection handler

Oct 2nd, 2017
381
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 14.42 KB | None | 0 0
  1. ==== Engine/Source/Runtime/Engine/Classes/AI/Navigation/AvoidanceManager.h (text) ====
  2.  
  3. @@ -44,7 +44,7 @@
  4.     float Weight;
  5.  
  6.     /** Weight is treated as a hard 1.0 while this is active. This is set by code. */
  7. -   float OverrideWeightTime;
  8. +   double OverrideWeightTime; //HOUSE!!!
  9.  
  10.     /** Group data */
  11.     int32 GroupMask;
  12.  
  13. ==== Engine/Source/Runtime/Engine/Classes/Camera/PlayerCameraManager.h (text) ====
  14.  
  15. @@ -47,7 +47,7 @@
  16.  
  17.     /** World time this entry was created. */
  18.     UPROPERTY()
  19. -   float TimeStamp;
  20. +   double TimeStamp; //HOUSE!!!
  21.  
  22.     /** Camera POV to cache. */
  23.     UPROPERTY()
  24. @@ -227,10 +227,10 @@
  25.     FVector OriginalColorScale;
  26.  
  27.     /** Total time for color scale interpolation to complete (when bEnableColorScaling and bEnableColorScaleInterp == true) */
  28. -   float ColorScaleInterpDuration;
  29. +   double ColorScaleInterpDuration; //HOUSE!!!
  30.  
  31.     /** Time at which interpolation started (when bEnableColorScaling and bEnableColorScaleInterp == true) */
  32. -   float ColorScaleInterpStartTime;
  33. +   double ColorScaleInterpStartTime; //HOUSE!!!
  34.  
  35.     /** Cached camera properties. */
  36.     UPROPERTY(transient)
  37.  
  38. ==== Engine/Source/Runtime/Engine/Classes/Engine/NetDriver.h (text) ====
  39.  
  40. @@ -178,7 +178,7 @@
  41.  
  42.     /** @todo document */
  43.     UPROPERTY(Config)
  44. -   float RelevantTimeout;
  45. +   double RelevantTimeout; //HOUSE!!!
  46.  
  47.     /** @todo document */
  48.     UPROPERTY(Config)
  49. @@ -253,7 +253,7 @@
  50.    
  51.     /** Accumulated time for the net driver, updated by Tick */
  52.     UPROPERTY()
  53. -   float                       Time;
  54. +   double                      Time; //HOUSE!!!
  55.  
  56.     /** Last realtime a tick dispatch occurred. Used currently to try and diagnose timeout issues */
  57.     double                      LastTickDispatchRealtime;
  58.  
  59. ==== Engine/Source/Runtime/Engine/Classes/Engine/NetworkObjectList.h (text) ====
  60.  
  61. @@ -36,7 +36,7 @@
  62.  
  63.     /** Last time this actor was updated for replication via NextUpdateTime
  64.     * @warning: internal net driver time, not related to WorldSettings.TimeSeconds */
  65. -   float LastNetUpdateTime;
  66. +   double LastNetUpdateTime; //HOUSE!!!
  67.  
  68.     /** Is this object still pending a full net update due to clients that weren't able to replicate the actor at the time of LastNetUpdateTime */
  69.     bool bPendingNetUpdate;
  70.  
  71. ==== Engine/Source/Runtime/Engine/Classes/Engine/World.h (text) ====
  72.  
  73. @@ -1166,7 +1166,7 @@
  74.     double LastTimeUnbuiltLightingWasEncountered;
  75.  
  76.     /**  Time in seconds since level began play, but IS paused when the game is paused, and IS dilated/clamped. */
  77. -   float TimeSeconds;
  78. +   double TimeSeconds; //HOUSE!!!
  79.  
  80.     /**  Time in seconds since level began play, but IS NOT paused when the game is paused, and IS dilated/clamped. */
  81.     float UnpausedTimeSeconds;
  82.  
  83. ==== Engine/Source/Runtime/Engine/Classes/GameFramework/Actor.h (text) ====
  84.  
  85. @@ -441,7 +441,7 @@
  86.     /** The time this actor was created, relative to World->GetTimeSeconds().
  87.     * @see UWorld::GetTimeSeconds()
  88.     */
  89. -   float CreationTime;
  90. +   double CreationTime; //HOUSE!!!
  91.  
  92.     /** Pawn responsible for damage caused by this actor. */
  93.     UPROPERTY(BlueprintReadWrite, replicatedUsing=OnRep_Instigator, meta=(ExposeOnSpawn=true), Category=Actor)
  94.  
  95. ==== Engine/Source/Runtime/Engine/Classes/GameFramework/CharacterMovementComponent.h (text) ====
  96.  
  97. @@ -2641,13 +2641,13 @@
  98.     FClientAdjustment PendingAdjustment;
  99.  
  100.     /** Timestamp from the Client of most recent ServerMove() processed for this player */
  101. -   float CurrentClientTimeStamp;
  102. +   double CurrentClientTimeStamp; //HOUSE!!!
  103.  
  104.     /** Last time server updated client with a move correction */
  105. -   float LastUpdateTime;
  106. +   double LastUpdateTime; //HOUSE!!!
  107.  
  108.     /** Server clock time when last server move was received from client (does NOT include forced moves on server) */
  109. -   float ServerTimeStampLastServerMove;
  110. +   double ServerTimeStampLastServerMove; //HOUSE!!!
  111.  
  112.     /** (DEPRECATED) How long server will wait for client move update before setting position */
  113.     DEPRECATED(4.12, "MaxResponseTime has been renamed to MaxMoveDeltaTime for clarity in what it does and will be removed, use MaxMoveDeltaTime instead.")
  114. @@ -2659,7 +2659,7 @@
  115.      * if needed.
  116.      * Note: This was previously named MaxResponseTime, but has been renamed to reflect what it does more accurately
  117.      */
  118. -   float MaxMoveDeltaTime;
  119. +   double MaxMoveDeltaTime; //HOUSE!!!
  120.  
  121.     /** Force client update on the next ServerMoveHandleClientError() call. */
  122.     uint32 bForceClientUpdate:1;
  123.  
  124. ==== Engine/Source/Runtime/Engine/Classes/GameFramework/GameNetworkManager.h (text) ====
  125.  
  126. @@ -37,7 +37,7 @@
  127.  
  128.     /**  Last time netspeed was updated for server (by client entering or leaving) */
  129.     UPROPERTY()
  130. -   float LastNetSpeedUpdateTime;
  131. +   double LastNetSpeedUpdateTime; //HOUSE!!!
  132.  
  133.     /** Total available bandwidth for listen server, split dynamically across net connections */
  134.     UPROPERTY(globalconfig)
  135.  
  136. ==== Engine/Source/Runtime/Engine/Classes/GameFramework/PlayerController.h (text) ====
  137.  
  138. @@ -257,7 +257,7 @@
  139.  
  140.     /** Used to make sure the client is kept synchronized when in a spectator state */
  141.     UPROPERTY()
  142. -   float LastSpectatorStateSynchTime;
  143. +   double LastSpectatorStateSynchTime; //HOUSE!!!
  144.  
  145.     /** Last location synced on the server for a spectator. */
  146.     UPROPERTY(Transient)
  147. @@ -1665,7 +1665,7 @@
  148.  
  149.  private:
  150.     /** Used to delay calling ClientRestart() again when it hasn't been appropriately acknowledged. */
  151. -   float       LastRetryPlayerTime;
  152. +   double      LastRetryPlayerTime; //HOUSE
  153.  
  154.     /** Set during SpawnActor once and never again to indicate the intent of this controller instance (SERVER ONLY) */
  155.     UPROPERTY()
  156.  
  157. ==== Engine/Source/Runtime/Engine/Private/AI/Navigation/AvoidanceManager.cpp (text) ====
  158.  
  159. @@ -313,7 +313,7 @@
  160.  
  161.     FVector ReturnVelocity = inAvoidanceData.Velocity * DeltaTime;
  162.     float MaxSpeed = ReturnVelocity.Size2D();
  163. -   float CurrentTime;
  164. +   double CurrentTime; //HOUSE!!!
  165.  
  166.     UWorld* MyWorld = Cast<UWorld>(GetOuter());
  167.     if (MyWorld)
  168.  
  169. ==== Engine/Source/Runtime/Engine/Private/NetworkDriver.cpp (text) ====
  170.  
  171. @@ -865,7 +865,7 @@
  172.                 NumValidConnections++;
  173.  
  174.                 const float HalfTimeout = Connection->GetTimeoutValue() * TimeoutPercentThreshold;
  175. -               const float DeltaTimeSinceLastMessage = Time - Connection->LastReceiveTime;
  176. +               const double DeltaTimeSinceLastMessage = Time - Connection->LastReceiveTime; //HOUSE!!!
  177.                 if (DeltaTimeSinceLastMessage > HalfTimeout)
  178.                 {
  179.                     NumLaggingConnections++;
  180. @@ -892,7 +892,7 @@
  181.         if (ensure(ServerConnection))
  182.         {
  183.             const float HalfTimeout = ServerConnection->GetTimeoutValue() * TimeoutPercentThreshold;
  184. -           const float DeltaTimeSinceLastMessage = Time - ServerConnection->LastReceiveTime;
  185. +           const double DeltaTimeSinceLastMessage = Time - ServerConnection->LastReceiveTime; //HOUSE!!!
  186.             if (DeltaTimeSinceLastMessage > HalfTimeout)
  187.             {
  188.                 // We have exceeded half our timeout. We are lagging.
  189. @@ -1187,7 +1187,7 @@
  190.  
  191.     const double CurrentRealtime = FPlatformTime::Seconds();
  192.  
  193. -   const float DeltaRealtime = CurrentRealtime - LastTickDispatchRealtime;
  194. +   const double DeltaRealtime = CurrentRealtime - LastTickDispatchRealtime; //HOUSE!!!
  195.  
  196.     LastTickDispatchRealtime = CurrentRealtime;
  197.  
  198. @@ -2460,7 +2460,7 @@
  199.  FActorPriority::FActorPriority(UNetConnection* InConnection, UActorChannel* InChannel, FNetworkObjectInfo* InActorInfo, const TArray<struct FNetViewer>& Viewers, bool bLowBandwidth)
  200.     : ActorInfo(InActorInfo), Channel(InChannel), DestructionInfo(NULL)
  201.  { 
  202. -   float Time  = Channel ? (InConnection->Driver->Time - Channel->LastUpdateTime) : InConnection->Driver->SpawnPrioritySeconds;
  203. +   double Time  = Channel ? (InConnection->Driver->Time - Channel->LastUpdateTime) : InConnection->Driver->SpawnPrioritySeconds; //HOUSE!!!
  204.     // take the highest priority of the viewers on this connection
  205.     Priority = 0;
  206.     for (int32 i = 0; i < Viewers.Num(); i++)
  207. @@ -2538,7 +2538,7 @@
  208.         //@note: we cannot add Connection->IsNetReady(0) here to check for saturation, as if that's the case we still want to figure out the list of relevant actors
  209.         //          to reset their NetUpdateTime so that they will get sent as soon as the connection is no longer saturated
  210.         AActor* OwningActor = Connection->OwningActor;
  211. -       if ( OwningActor != NULL && Connection->State == USOCK_Open && ( Connection->Driver->Time - Connection->LastReceiveTime < 1.5f ) )
  212. +       if ( OwningActor != NULL && Connection->State == USOCK_Open && ( Connection->Driver->Time - Connection->LastReceiveTime < 1.5 ) ) //HOUSE!!!
  213.         {
  214.             check( World == OwningActor->GetWorld() );
  215.  
  216. @@ -3269,7 +3269,7 @@
  217.                     PriorityActors[k]->ActorInfo->bPendingNetUpdate = true;
  218.                     if ( Channel != NULL )
  219.                     {
  220. -                       Channel->RelevantTime = Time + 0.5f * FMath::SRand();
  221. +                       Channel->RelevantTime = Time + 0.5 * FMath::SRand(); //HOUSE!!!
  222.                     }
  223.                 }
  224.             }
  225.  
  226. ==== Engine/Source/Runtime/Engine/Private/PacketHandlers/StatelessConnectHandlerComponent.cpp (text) ====
  227.  
  228. @@ -119,7 +119,7 @@
  229.   * Defines
  230.   */
  231.  
  232. -#define HANDSHAKE_PACKET_SIZE_BITS 194
  233. +#define HANDSHAKE_PACKET_SIZE_BITS 226 //HOUSE!!!
  234.  
  235.  
  236.  // The number of seconds between secret value updates, and the random variance applied to this
  237. @@ -163,7 +163,7 @@
  238.  
  239.         // In order to prevent DRDoS reflection amplification attacks, clients must pad the packet to match server handshake packet size
  240.         uint8 SecretIdPad = 0;
  241. -       uint8 PacketSizeFiller[24];
  242. +       uint8 PacketSizeFiller[28]; //HOUSE!!!
  243.  
  244.         InitialPacket.WriteBit(SecretIdPad);
  245.  
  246. @@ -211,7 +211,7 @@
  247.     {
  248.         FBitWriter ChallengePacket(HANDSHAKE_PACKET_SIZE_BITS + 1 /* Termination bit */);
  249.         uint8 bHandshakePacket = 1;
  250. -       float Timestamp = (Driver != nullptr ? Driver->Time : -1.f);
  251. +       double Timestamp = (Driver != nullptr ? Driver->Time : -1.); //HOUSE!!!
  252.         uint8 Cookie[20];
  253.  
  254.         GenerateCookie(ClientAddress, ActiveSecret, Timestamp, Cookie);
  255. @@ -260,7 +260,7 @@
  256.     }
  257.  }
  258.  
  259. -void StatelessConnectHandlerComponent::SendChallengeResponse(uint8 InSecretId, float InTimestamp, uint8 InCookie[20])
  260. +void StatelessConnectHandlerComponent::SendChallengeResponse(uint8 InSecretId, double InTimestamp, uint8 InCookie[24]) //HOUSE!!!
  261.  {
  262.     UNetConnection* ServerConn = (Driver != nullptr ? Driver->ServerConnection : NULL);
  263.  
  264. @@ -348,7 +348,7 @@
  265.     if (bHandshakePacket)
  266.     {
  267.         uint8 SecretId = 0;
  268. -       float Timestamp = 1.f;
  269. +       double Timestamp = 1.; //HOUSE!!!
  270.         uint8 Cookie[20];
  271.  
  272.         bHandshakePacket = ParseHandshakePacket(Packet, SecretId, Timestamp, Cookie);
  273. @@ -416,7 +416,7 @@
  274.     if (bHandshakePacket)
  275.     {
  276.         uint8 SecretId = 0;
  277. -       float Timestamp = 1.f;
  278. +       double Timestamp = 1.; //HOUSE!!!
  279.         uint8 Cookie[20];
  280.  
  281.         bHandshakePacket = ParseHandshakePacket(Packet, SecretId, Timestamp, Cookie);
  282. @@ -435,8 +435,8 @@
  283.                 else if (Driver != nullptr)
  284.                 {
  285.                     bool bChallengeSuccess = false;
  286. -                   float CookieDelta = Driver->Time - Timestamp;
  287. -                   float SecretDelta = Timestamp - LastSecretUpdateTimestamp;
  288. +                   double CookieDelta = Driver->Time - Timestamp; //HOUSE!!!
  289. +                   double SecretDelta = Timestamp - LastSecretUpdateTimestamp; //HOUSE!!!
  290.                     bool bValidCookieLifetime = CookieDelta > 0.0 && (MAX_COOKIE_LIFETIME - CookieDelta) > 0.f;
  291.                     bool bValidSecretIdTimestamp = (SecretId == ActiveSecret) ? (SecretDelta >= 0.f) : (SecretDelta <= 0.f);
  292.  
  293. @@ -474,7 +474,7 @@
  294.  #endif
  295.  }
  296.  
  297. -bool StatelessConnectHandlerComponent::ParseHandshakePacket(FBitReader& Packet, uint8& OutSecretId, float& OutTimestamp,
  298. +bool StatelessConnectHandlerComponent::ParseHandshakePacket(FBitReader& Packet, uint8& OutSecretId, double& OutTimestamp, //HOUSE!!!
  299.                                                             uint8 (&OutCookie)[20])
  300.  {
  301.     bool bValidPacket = false;
  302. @@ -494,7 +494,7 @@
  303.     return bValidPacket;
  304.  }
  305.  
  306. -void StatelessConnectHandlerComponent::GenerateCookie(FString ClientAddress, uint8 SecretId, float Timestamp, uint8 (&OutCookie)[20])
  307. +void StatelessConnectHandlerComponent::GenerateCookie(FString ClientAddress, uint8 SecretId, double Timestamp, uint8 (&OutCookie)[20]) //HOUSE!!!
  308.  {
  309.     // @todo #JohnB: Add cpu stats tracking, like what Oodle does upon compression
  310.     //                  NOTE: Being serverside, will only show up in .uprof, not on any 'stat' commands. Still necessary though.
  311.  
  312. ==== Engine/Source/Runtime/Engine/Private/PlayerCameraManager.cpp (text) ====
  313.  
  314. @@ -883,7 +883,7 @@
  315.     // update color scale interpolation
  316.     if (bEnableColorScaleInterp)
  317.     {
  318. -       float BlendPct = FMath::Clamp((GetWorld()->TimeSeconds - ColorScaleInterpStartTime) / ColorScaleInterpDuration, 0.f, 1.0f);
  319. +       float BlendPct = FMath::Clamp((GetWorld()->TimeSeconds - ColorScaleInterpStartTime) / ColorScaleInterpDuration, 0., 1.0); //HOUSE!!!
  320.         ColorScale = FMath::Lerp(OriginalColorScale, DesiredColorScale, BlendPct);
  321.         // if we've maxed
  322.         if (BlendPct == 1.0f)
  323.  
  324. ==== Engine/Source/Runtime/Engine/Public/PacketHandlers/StatelessConnectHandlerComponent.h (text) ====
  325.  
  326. @@ -60,7 +60,7 @@
  327.      * @param InTimestamp       The timestamp value to send
  328.      * @param InCookie          The cookie value to send
  329.      */
  330. -   void SendChallengeResponse(uint8 InSecretId, float InTimestamp, uint8 InCookie[20]);
  331. +   void SendChallengeResponse(uint8 InSecretId, double InTimestamp, uint8 InCookie[20]); //HOUSE!!!
  332.  
  333.  
  334.     /**
  335. @@ -122,7 +122,7 @@
  336.      * @param OutCookie     A unique identifier, generated by the server, which the client must reply with (or 0, for initial packet)
  337.      * @return              Whether or not the handshake packet was parsed successfully
  338.      */
  339. -   bool ParseHandshakePacket(FBitReader& Packet, uint8& OutSecretId, float& OutTimestamp, uint8 (&OutCookie)[20]);
  340. +   bool ParseHandshakePacket(FBitReader& Packet, uint8& OutSecretId, double& OutTimestamp, uint8 (&OutCookie)[20]); //HOUSE!!!
  341.  
  342.     /**
  343.      * Takes the client address plus server timestamp, and outputs a deterministic cookie value
  344. @@ -132,7 +132,7 @@
  345.      * @param TimeStamp         The serverside timestamp
  346.      * @param OutCookie         Outputs the generated cookie value.
  347.      */
  348. -   void GenerateCookie(FString ClientAddress, uint8 SecretId, float Timestamp, uint8 (&OutCookie)[20]);
  349. +   void GenerateCookie(FString ClientAddress, uint8 SecretId, double Timestamp, uint8 (&OutCookie)[20]); //HOUSE!!!
  350.  
  351.     /**
  352.      * Generates a new HandshakeSecret value
  353. @@ -154,7 +154,7 @@
  354.     uint8 ActiveSecret;
  355.  
  356.     /** The time of the last secret value update */
  357. -   float LastSecretUpdateTimestamp;
  358. +   double LastSecretUpdateTimestamp; //HOUSE!!!
  359.  
  360.     /** The last address to successfully complete the handshake challenge */
  361.     FString LastChallengeSuccessAddress;
  362. @@ -173,7 +173,7 @@
  363.     uint8 LastSecretId;
  364.  
  365.     /** The Timestamp value of the last challenge response sent */
  366. -   float LastTimestamp;
  367. +   double LastTimestamp; //HOUSE!!!
  368.  
  369.     /** The Cookie value of the last challenge response sent */
  370.     uint8 LastCookie[20];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement