From a70290bb1d4f9f876a8d9a0049b6378fa18aed03 Mon Sep 17 00:00:00 2001 From: PJ Fanning Date: Mon, 16 Dec 2024 22:59:17 +0100 Subject: [PATCH] support tcp protocols --- .../apache/pekko/cluster/ClusterDaemon.scala | 23 ++++++++++++++----- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/cluster/src/main/scala/org/apache/pekko/cluster/ClusterDaemon.scala b/cluster/src/main/scala/org/apache/pekko/cluster/ClusterDaemon.scala index 9ddb9bc8bf..bc14f7864a 100644 --- a/cluster/src/main/scala/org/apache/pekko/cluster/ClusterDaemon.scala +++ b/cluster/src/main/scala/org/apache/pekko/cluster/ClusterDaemon.scala @@ -13,13 +13,13 @@ package org.apache.pekko.cluster +import scala.annotation.nowarn import scala.collection.immutable import scala.concurrent.Future import scala.concurrent.Promise import scala.concurrent.duration._ import scala.util.control.NonFatal -import scala.annotation.nowarn import com.typesafe.config.Config import org.apache.pekko @@ -30,13 +30,12 @@ import pekko.annotation.InternalApi import pekko.cluster.ClusterEvent._ import pekko.cluster.MemberStatus._ import pekko.dispatch.{ RequiresMessageQueue, UnboundedMessageQueueSemantics } -import pekko.event.ActorWithLogClass -import pekko.event.Logging +import pekko.event.{ ActorWithLogClass, Logging } import pekko.pattern.ask import pekko.remote.{ QuarantinedEvent => ClassicQuarantinedEvent } import pekko.remote.artery.QuarantinedEvent -import pekko.util.Timeout -import pekko.util.Version +import pekko.util.{ Timeout, Version } +import pekko.util.ccompat.JavaConverters._ /** * Base trait for all cluster messages. All ClusterMessage's are serializable. @@ -365,7 +364,19 @@ private[cluster] class ClusterCoreDaemon(publisher: ActorRef, joinConfigCompatCh val statsEnabled = PublishStatsInterval.isFinite var gossipStats = GossipStats() - val acceptedProtocols = context.system.settings.config.getStringList("pekko.remote.accept-protocol-names") + val acceptedProtocols: Set[String] = { + val initList = context.system.settings.config + .getStringList("pekko.remote.accept-protocol-names") + .asScala + initList.toSeq.foreach { protocol => + if (!protocol.endsWith(".tcp")) { + val tcpProtocol = s"$protocol.tcp" + if (!initList.contains(tcpProtocol)) + initList.+=(tcpProtocol) + } + } + initList.toSet + } var seedNodes = SeedNodes var seedNodeProcess: Option[ActorRef] = None