lgoldstein commented on a change in pull request #201:
URL: https://github.com/apache/mina-sshd/pull/201#discussion_r668893454
##########
File path:
sshd-core/src/main/java/org/apache/sshd/common/session/helpers/AbstractSession.java
##########
@@ -696,7 +702,18 @@ protected void handleKexInit(Buffer buffer) throws
Exception {
protected void doKexNegotiation() throws Exception {
if (kexState.compareAndSet(KexState.DONE, KexState.RUN)) {
sendKexInit();
- } else if (!kexState.compareAndSet(KexState.INIT, KexState.RUN)) {
+ } else if (kexState.compareAndSet(KexState.INIT, KexState.RUN)) {
+ DefaultKeyExchangeFuture initFuture;
+ synchronized (kexState) {
+ initFuture = kexInitializedFuture;
+ if (initFuture == null) {
+ initFuture = new DefaultKeyExchangeFuture(toString(),
kexLock);
+ kexInitializedFuture = initFuture;
+ }
+ }
+
+ initFuture.await();
Review comment:
I am not comfortable with an infinite wait - just in case some
deadlock/bug occurs. Let's define a
`CoreModuleProperties#MAX_KEX_INIT_WAIT_TIMEOUT` and use it here (I think ~30
seconds as default value should do, but you are welcome to use some other
value). If it expires then throw an exception (which will close the session).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]