gnodet edited a comment on pull request #156:
URL: https://github.com/apache/mina-sshd/pull/156#issuecomment-670396237


   @lgoldstein you're right, there are a few tests that do use multiple calls 
to `auth()`.
   So maybe the following instead:
   ```
   diff --git 
a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSessionImpl.java 
b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSessionImpl.java
   index 21e0631d..9f9b8015 100644
   --- 
a/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSessionImpl.java
   +++ 
b/sshd-core/src/main/java/org/apache/sshd/client/session/ClientSessionImpl.java
   @@ -85,9 +85,6 @@ public class ClientSessionImpl extends 
AbstractClientSession {
                nextServiceFactory = null;
            }
   
   -        authFuture = new DefaultAuthFuture(ioSession.getRemoteAddress(), 
futureLock);
   -        authFuture.setAuthed(false);
   -
            signalSessionCreated(ioSession);
   
            /*
   @@ -124,9 +121,18 @@ public class ClientSessionImpl extends 
AbstractClientSession {
            ClientUserAuthService authService = getUserAuthService();
            synchronized (sessionLock) {
                String serviceName = nextServiceName();
   -            authFuture = ValidateUtils.checkNotNull(
   +            authFuture = new 
DefaultAuthFuture(getIoSession().getRemoteAddress(), futureLock);
   +            AuthFuture future = ValidateUtils.checkNotNull(
                        authService.auth(serviceName), "No auth future 
generated by service=%s", serviceName);
   -            return authFuture;
   +            future.addListener(f -> {
   +                Throwable e = f.getException();
   +                if (e != null) {
   +                    this.authFuture.setException(e);
   +                } else {
   +                    this.authFuture.setAuthed(f.isSuccess());
   +                }
   +            });
   +            return this.authFuture;
            }
        }
   ```


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to