Check disconnected flag on each operation 40/102740/5
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 18 Oct 2022 14:44:39 +0000 (16:44 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 18 Oct 2022 15:03:09 +0000 (17:03 +0200)
commitbdc0153931463070df6d03c75357e08f65bb9783
treeb340882ae391cec0d05d54fa4a2818e13714e9ca
parent5038dde5cdb878badaa4328e3956409917f1eaf4
Check disconnected flag on each operation

We are performing a staggered setup during which we may encounter an
asynchronous disconnect. We have an atomic flag guarding this, which is
always flipped before disconnect enters critical region.

Check the flag at each synchronized connect stage and abort connection
if it is observed as flipped -- ensuring we cannot accidentally signal
channel activation after the channel has been close()d.

Also ditch the AtomicBoolean and instead use a simple VarHandle, saving
a few bytes of overhead.

JIRA: NETCONF-905
Change-Id: I857b1768b083c13ac5060a803a9ba6d4008c5e4b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
netconf/netconf-netty-util/src/main/java/org/opendaylight/netconf/nettyutil/handler/ssh/client/AsyncSshHandler.java