You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2021/12/06 22:44:00 UTC

[couchdb] 01/01: Fix TLS custom (couch) dist for Erlang 20

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

vatamane pushed a commit to branch fix-couch-dist-for-erlang-20
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 46cbfab4bb7c4919210fb6ba51b4bb19f57d1d33
Author: Nick Vatamaniuc <va...@gmail.com>
AuthorDate: Mon Dec 6 17:21:09 2021 -0500

    Fix TLS custom (couch) dist for Erlang 20
    
     * Fix quoting so that it works with all OTP versions 20 through 24 [1].
    
     * Dist API in 20 [2] did not have a `listen/2` [3] callback. Implement
       `listen/1` so we're compatible with all the supported OTP versions.
    
    [1] https://github.com/apache/couchdb/issues/3821#issuecomment-985089867
    [2] https://github.com/erlang/otp/blob/maint-20/lib/kernel/src/inet_tcp_dist.erl#L71-L72
    [3] https://github.com/erlang/otp/blob/master/lib/kernel/src/inet_tcp_dist.erl#L79-L80
---
 rel/overlay/etc/vm.args           |  2 +-
 src/couch_dist/src/couch_dist.erl | 10 ++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/rel/overlay/etc/vm.args b/rel/overlay/etc/vm.args
index 805e9ec..8da600b 100644
--- a/rel/overlay/etc/vm.args
+++ b/rel/overlay/etc/vm.args
@@ -91,5 +91,5 @@
 ## Don't forget to override the paths to point to your certificate(s) and key(s)!
 ##
 #-proto_dist couch
-#-couch_dist no_tls \"clouseau@127.0.0.1\"
+#-couch_dist no_tls '"clouseau@127.0.0.1"'
 #-ssl_dist_optfile <path/to/couch_ssl_dist.conf>
diff --git a/src/couch_dist/src/couch_dist.erl b/src/couch_dist/src/couch_dist.erl
index 9a6b26d..a3dd568 100644
--- a/src/couch_dist/src/couch_dist.erl
+++ b/src/couch_dist/src/couch_dist.erl
@@ -14,6 +14,7 @@
 
 -export([
     childspecs/0,
+    listen/1,
     listen/2,
     accept/1,
     accept_connection/5,
@@ -33,6 +34,15 @@ childspecs() ->
         ]}
     ]}.
 
+listen(Name) ->
+    NodeName =
+        case is_atom(Name) of
+            true -> atom_to_list(Name);
+            false -> Name
+        end,
+    Mod = inet_dist(NodeName ++ "@127.0.0.1"),
+    Mod:listen(NodeName).
+
 listen(Name, Host) ->
     NodeName =
         case is_atom(Name) of