Skip to content

Commit 542840d

Browse files
committed
try to fix issue in Remoting
1 parent aba5c84 commit 542840d

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

remote/src/main/scala/org/apache/pekko/remote/Remoting.scala

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,11 +225,12 @@ private[remote] class Remoting(_system: ExtendedActorSystem, _provider: RemoteAc
225225
Await.result(addressesPromise.future, StartupTimeout.duration)
226226
if (transports.isEmpty) throw new RemoteTransportException("No transport drivers were loaded.", null)
227227

228-
transportMapping = transports
228+
val mapping = transports
229229
.groupBy {
230230
case (transport, _) => transport.schemeIdentifier
231231
}
232232
.map { case (k, v) => k -> v.toSet }
233+
transportMapping = addProtocolsToMap(mapping)
233234

234235
defaultAddress = transports.head._2
235236
addresses = transports.map { _._2 }.toSet
@@ -296,6 +297,21 @@ private[remote] class Remoting(_system: ExtendedActorSystem, _provider: RemoteAc
296297
}
297298
}
298299
}
300+
301+
private def addProtocolsToMap(
302+
map: Map[String, Set[(PekkoProtocolTransport, Address)]]): Map[String, Set[(PekkoProtocolTransport, Address)]] = {
303+
if (AcceptProtocolNames.size > 1) {
304+
map.flatMap { case (protocol, transports) =>
305+
val tcpProtocol = protocol.endsWith(".tcp")
306+
AcceptProtocolNames.map { newProtocol =>
307+
if (tcpProtocol)
308+
s"$newProtocol.tcp" -> transports
309+
else
310+
newProtocol -> transports
311+
}
312+
}
313+
} else map
314+
}
299315
}
300316

301317
/**
@@ -567,7 +583,7 @@ private[remote] class EndpointManager(conf: Config, log: LoggingAdapter)
567583
}
568584

569585
OneForOneStrategy(loggingEnabled = false) {
570-
case InvalidAssociation(localAddress, remoteAddress, reason, disassiciationInfo) =>
586+
case InvalidAssociation(localAddress, remoteAddress, reason, disassociationInfo) =>
571587
keepQuarantinedOr(remoteAddress) {
572588
val causedBy = if (reason.getCause == null) "" else s"Caused by: [${reason.getCause.getMessage}]"
573589
log.warning(
@@ -580,7 +596,7 @@ private[remote] class EndpointManager(conf: Config, log: LoggingAdapter)
580596
causedBy)
581597
endpoints.markAsFailed(sender(), Deadline.now + settings.RetryGateClosedFor)
582598
}
583-
disassiciationInfo.foreach {
599+
disassociationInfo.foreach {
584600
case AssociationHandle.Quarantined =>
585601
context.system.eventStream.publish(ThisActorSystemQuarantinedEvent(localAddress, remoteAddress))
586602
case _ => // do nothing

0 commit comments

Comments
 (0)