qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From c...@apache.org
Subject qpid-dispatch git commit: DISPATCH-1106: Reduce chance of routers using same link name random seed
Date Thu, 23 Aug 2018 20:31:06 GMT
Repository: qpid-dispatch
Updated Branches:
  refs/heads/master 2469f4bca -> 8a8b6376c


DISPATCH-1106: Reduce chance of routers using same link name random seed


Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/8a8b6376
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/8a8b6376
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/8a8b6376

Branch: refs/heads/master
Commit: 8a8b6376cbcf2e04e4dddcfd18bb5a683e837964
Parents: 2469f4b
Author: Chuck Rolke <crolke@redhat.com>
Authored: Thu Aug 23 16:30:58 2018 -0400
Committer: Chuck Rolke <crolke@redhat.com>
Committed: Thu Aug 23 16:30:58 2018 -0400

----------------------------------------------------------------------
 src/router_node.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/8a8b6376/src/router_node.c
----------------------------------------------------------------------
diff --git a/src/router_node.c b/src/router_node.c
index c7bec23..5bbab94 100644
--- a/src/router_node.c
+++ b/src/router_node.c
@@ -1241,8 +1241,9 @@ qd_router_t *qd_router(qd_dispatch_t *qd, qd_router_mode_t mode, const
char *are
     //
     // Seed the random number generator
     //
-    unsigned int seed = (unsigned int) time(0);
-    srandom(seed);
+    struct timeval time;
+    gettimeofday(&time, NULL);
+    srandom((unsigned int)time.tv_sec + ((unsigned int)time.tv_usec << 11));
 
     switch (router->router_mode) {
     case QD_ROUTER_MODE_STANDALONE: qd_log(router->log_source, QD_LOG_INFO, "Router started
in Standalone mode");  break;


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


Mime
View raw message