From: Oleksii Mozghovyi Date: Tue, 15 Dec 2020 13:55:16 +0000 (+0200) Subject: Fix NETCONF session(channel) activation for the CallHome(over TLS) X-Git-Tag: v1.13.0~39 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=ec978f18df800cd51d882d4b3c0bfa7b3fa72fb3;p=netconf.git Fix NETCONF session(channel) activation for the CallHome(over TLS) This patch fixes an issue when activation always fails with a message saying that "Session is already activated". The root cause is the behavior of the compareAndExchange method(returns the witness value, which will be the same as the expected value if successful). JIRA: NETCONF-5 Change-Id: Ib9b0acead1091c8e881330c22b99c9138605e1f1 Signed-off-by: Oleksii Mozghovyi --- diff --git a/netconf/callhome-protocol/src/main/java/org/opendaylight/netconf/callhome/protocol/tls/CallHomeTlsSessionContext.java b/netconf/callhome-protocol/src/main/java/org/opendaylight/netconf/callhome/protocol/tls/CallHomeTlsSessionContext.java index 7d8334c146..ed62468428 100644 --- a/netconf/callhome-protocol/src/main/java/org/opendaylight/netconf/callhome/protocol/tls/CallHomeTlsSessionContext.java +++ b/netconf/callhome-protocol/src/main/java/org/opendaylight/netconf/callhome/protocol/tls/CallHomeTlsSessionContext.java @@ -69,7 +69,7 @@ final class CallHomeTlsSessionContext implements CallHomeProtocolSessionContext private Promise doActivate(final Channel ch, final NetconfClientSessionListener listener) { final Promise activationPromise = newSessionPromise(); - if (!activated.compareAndExchange(false, true)) { + if (activated.compareAndExchange(false, true)) { return activationPromise.setFailure(new IllegalStateException("Session (channel) already activated.")); }