Skip to content

Commit

Permalink
Added setIssueHandshake() to enable auto-handshake
Browse files Browse the repository at this point in the history
  • Loading branch information
Endre Sándor Varga committed Jan 3, 2013
1 parent f2aa947 commit 01e3c5f
Showing 1 changed file with 10 additions and 2 deletions.
Expand Up @@ -23,6 +23,7 @@ import util.control.{ NoStackTrace, NonFatal }
import akka.dispatch.ThreadPoolConfig
import akka.remote.transport.AssociationHandle.HandleEventListener
import java.util.concurrent.atomic.AtomicInteger
import org.jboss.netty.handler.ssl.SslHandler

object NettyTransportSettings {
sealed trait Mode
Expand Down Expand Up @@ -230,10 +231,17 @@ class NettyTransport(private val settings: NettyTransportSettings, private val s
}

private val associationListenerPromise: Promise[AssociationEventListener] = Promise()

private def sslHandler(isClient: Boolean): SslHandler = {
val handler = NettySSLSupport(settings.SslSettings.get, log, isClient)
handler.setIssueHandshake(true)
handler
}

private val serverPipelineFactory: ChannelPipelineFactory = new ChannelPipelineFactory {
override def getPipeline: ChannelPipeline = {
val pipeline = newPipeline
if (EnableSsl) pipeline.addFirst("SslHandler", NettySSLSupport(settings.SslSettings.get, log, false))
if (EnableSsl) pipeline.addFirst("SslHandler", sslHandler(false))
val handler = if (isDatagram) new UdpServerHandler(NettyTransport.this, associationListenerPromise.future)
else new TcpServerHandler(NettyTransport.this, associationListenerPromise.future)
pipeline.addLast("ServerHandler", handler)
Expand All @@ -244,7 +252,7 @@ class NettyTransport(private val settings: NettyTransportSettings, private val s
private def clientPipelineFactory(statusPromise: Promise[AssociationHandle]): ChannelPipelineFactory = new ChannelPipelineFactory {
override def getPipeline: ChannelPipeline = {
val pipeline = newPipeline
if (EnableSsl) pipeline.addFirst("SslHandler", NettySSLSupport(settings.SslSettings.get, log, true))
if (EnableSsl) pipeline.addFirst("SslHandler", sslHandler(true))
val handler = if (isDatagram) new UdpClientHandler(NettyTransport.this, statusPromise)
else new TcpClientHandler(NettyTransport.this, statusPromise)
pipeline.addLast("clienthandler", handler)
Expand Down

0 comments on commit 01e3c5f

Please sign in to comment.