qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tr...@apache.org
Subject svn commit: r1565798 - /qpid/dispatch/trunk/src/router_node.c
Date Fri, 07 Feb 2014 20:36:54 GMT
Author: tross
Date: Fri Feb  7 20:36:53 2014
New Revision: 1565798

URL: http://svn.apache.org/r1565798
Log:
DISPATCH-28 - Increased the size of the random portion of temporary addresses.

Modified:
    qpid/dispatch/trunk/src/router_node.c

Modified: qpid/dispatch/trunk/src/router_node.c
URL: http://svn.apache.org/viewvc/qpid/dispatch/trunk/src/router_node.c?rev=1565798&r1=1565797&r2=1565798&view=diff
==============================================================================
--- qpid/dispatch/trunk/src/router_node.c (original)
+++ qpid/dispatch/trunk/src/router_node.c Fri Feb  7 20:36:53 2014
@@ -209,12 +209,16 @@ static void qd_router_generate_temp_addr
 {
     static const char *table = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+_";
     char     discriminator[11];
-    long int rnd = random();
+    long int rnd1 = random();
+    long int rnd2 = random();
     int      idx;
+    int      cursor = 0;
 
-    for (idx = 0; idx < 6; idx++)
-        discriminator[idx] = table[(rnd >> (idx * 6)) & 63];
-    discriminator[idx] = '\0';
+    for (idx = 0; idx < 5; idx++) {
+        discriminator[cursor++] = table[(rnd1 >> (idx * 6)) & 63];
+        discriminator[cursor++] = table[(rnd2 >> (idx * 6)) & 63];
+    }
+    discriminator[cursor] = '\0';
 
     snprintf(buffer, length, "amqp:/%s%s/%s/temp.%s", topo_prefix, router->router_area,
router->router_id, discriminator);
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message