From: kjaniak Date: Thu, 24 Jan 2019 06:29:50 +0000 (+0100) Subject: Mitigation of unexpected hv-ves shutdown X-Git-Tag: 1.1.0~60 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=68a3cf84da13b6f97628c8a0cee86c3323c780ce;p=dcaegen2%2Fcollectors%2Fhv-ves.git Mitigation of unexpected hv-ves shutdown Change-Id: I96183e2358ac10457568d223f37d69c61dfd252d Issue-ID: DCAEGEN2-1117 Signed-off-by: kjaniak --- diff --git a/build/hv-collector-analysis/src/main/resources/onap-detekt-config.yml b/build/hv-collector-analysis/src/main/resources/onap-detekt-config.yml index e35dcc5e..36f092dd 100644 --- a/build/hv-collector-analysis/src/main/resources/onap-detekt-config.yml +++ b/build/hv-collector-analysis/src/main/resources/onap-detekt-config.yml @@ -116,6 +116,7 @@ complexity: thresholdInObjects: 11 thresholdInEnums: 11 ignoreDeprecated: false + ignorePrivate: true empty-blocks: active: true diff --git a/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/socket/NettyTcpServer.kt b/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/socket/NettyTcpServer.kt index c76233f0..adc629bc 100644 --- a/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/socket/NettyTcpServer.kt +++ b/sources/hv-collector-core/src/main/kotlin/org/onap/dcae/collectors/veshv/impl/socket/NettyTcpServer.kt @@ -93,7 +93,12 @@ internal class NettyTcpServer(private val serverConfig: ServerConfiguration, } logger.debug(clientContext::fullMdc, Marker.Entry) { "Client connection request received" } - return collectorProvider(clientContext).fold( + messageHandlingStream(clientContext, nettyInbound).subscribe() + return nettyOutbound.neverComplete() + } + + private fun messageHandlingStream(clientContext: ClientContext, nettyInbound: NettyInbound): Mono = + collectorProvider(clientContext).fold( { logger.warn(clientContext::fullMdc) { "Collector not ready. Closing connection..." } Mono.empty() @@ -108,7 +113,6 @@ internal class NettyTcpServer(private val serverConfig: ServerConfiguration, it.handleConnection(createDataStream(nettyInbound)) } ) - } private fun populateClientContext(clientContext: ClientContext, connection: Connection) { clientContext.clientAddress = try { diff --git a/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/adapters/VesHvClient.kt b/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/adapters/VesHvClient.kt index 8de7da32..db5e5e82 100644 --- a/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/adapters/VesHvClient.kt +++ b/sources/hv-collector-xnf-simulator/src/main/kotlin/org/onap/dcae/collectors/veshv/simulators/xnf/impl/adapters/VesHvClient.kt @@ -22,9 +22,9 @@ package org.onap.dcae.collectors.veshv.simulators.xnf.impl.adapters import arrow.core.Option import arrow.core.getOrElse import io.netty.handler.ssl.SslContext -import org.onap.dcae.collectors.veshv.domain.WireFrameMessage import org.onap.dcae.collectors.veshv.domain.SecurityConfiguration import org.onap.dcae.collectors.veshv.domain.WireFrameEncoder +import org.onap.dcae.collectors.veshv.domain.WireFrameMessage import org.onap.dcae.collectors.veshv.simulators.xnf.impl.config.SimulatorConfiguration import org.onap.dcae.collectors.veshv.ssl.boundary.ClientSslContextFactory import org.onap.dcae.collectors.veshv.utils.arrow.asIo