You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@royale.apache.org by ca...@apache.org on 2018/05/31 16:50:44 UTC

[royale-asjs] branch develop updated: UUID was has more length than expected by BlazeDS generating messages with "correlationId" instead of "correlationIdBytes", this is since getTime() in JS gives 11 digits instead of 8 like in flash

This is an automated email from the ASF dual-hosted git repository.

carlosrovira pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git


The following commit(s) were added to refs/heads/develop by this push:
     new f2b4ba8  UUID was has more length than expected by BlazeDS generating messages with "correlationId" instead of "correlationIdBytes", this is since getTime() in JS gives 11 digits instead of 8 like in flash
f2b4ba8 is described below

commit f2b4ba85bd3fb244f002f5daf159f616786aaf1e
Author: Carlos Rovira <ca...@apache.org>
AuthorDate: Thu May 31 18:50:39 2018 +0200

    UUID was has more length than expected by BlazeDS generating messages with "correlationId" instead of "correlationIdBytes", this is since getTime() in JS gives 11 digits instead of 8 like in flash
---
 .../main/royale/org/apache/royale/net/utils/RPCUIDUtil.as    | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/frameworks/projects/Network/src/main/royale/org/apache/royale/net/utils/RPCUIDUtil.as b/frameworks/projects/Network/src/main/royale/org/apache/royale/net/utils/RPCUIDUtil.as
index 15cf2ad..b8a5301 100644
--- a/frameworks/projects/Network/src/main/royale/org/apache/royale/net/utils/RPCUIDUtil.as
+++ b/frameworks/projects/Network/src/main/royale/org/apache/royale/net/utils/RPCUIDUtil.as
@@ -38,8 +38,7 @@ package org.apache.royale.net.utils
          *  @private
          *  Char codes for 0123456789ABCDEF
          */
-        private static const ALPHA_CHAR_CODES:Array = [48, 49, 50, 51, 52, 53, 54, 
-            55, 56, 57, 65, 66, 67, 68, 69, 70];
+        private static const ALPHA_CHAR_CODES:Array = [48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 65, 66, 67, 68, 69, 70];
 
         private static const DASH:int = 45;       // dash ascii
         private static const UIDBuffer:BinaryData = new BinaryData();       // static ByteArray used for UID generation to save memory allocation cost
@@ -91,7 +90,14 @@ package org.apache.royale.net.utils
 
             UIDBuffer.writeByte(DASH);
 
-            var time:uint = new Date().getTime(); // extract last 8 digits
+            COMPILE::JS
+            {
+                var time:uint = Math.floor(new Date().getTime()/1000); // extract last 8 digits
+            }
+            COMPILE::SWF
+            {
+                var time:uint = new Date().getTime(); // extract last 8 digits
+            }
             var timeString:String = time.toString(16).toUpperCase();
             // 0xFFFFFFFF milliseconds ~= 3 days, so timeString may have between 1 and 8 digits, hence we need to pad with 0s to 8 digits
             for (i = 8; i > timeString.length; i--)

-- 
To stop receiving notification emails like this one, please contact
carlosrovira@apache.org.