You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2018/11/29 06:12:01 UTC

[GitHub] jaydoane commented on a change in pull request #1774: Support for more than 3 nodes dev cluster

jaydoane commented on a change in pull request #1774: Support for more than 3 nodes dev cluster
URL: https://github.com/apache/couchdb/pull/1774#discussion_r237361814
 
 

 ##########
 File path: dev/run
 ##########
 @@ -217,9 +249,42 @@ def apply_config_overrides(ctx, content):
     return content
 
 
-def get_ports(idnode):
+def get_ports(ctx, idnode):
     assert idnode
-    return ((10000 * idnode) + 5984, (10000 * idnode) + 5986)
+    if idnode <= 5 and not ctx['random_ports']:
+        return ((10000 * idnode) + 5984, (10000 * idnode) + 5986)
+    else:
+        return tuple(get_random_ports(2))
+
+
+def get_random_ports(num):
+    ports = []
+    while len(ports) < num:
+        with contextlib.closing(socket.socket(socket.AF_INET, socket.SOCK_STREAM)) as soc:
 
 Review comment:
   Presumably we hope that we these ports are released fast enough that they will subsequently be available for a booting erlang node to rebind?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services