gnodet commented on pull request #156:
URL: https://github.com/apache/mina-sshd/pull/156#issuecomment-670253433
What about using something like the following instead of multiple fields to
store the exception ?
```
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..4037f23a 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
@@ -86,7 +86,6 @@ public class ClientSessionImpl extends
AbstractClientSession {
}
authFuture = new DefaultAuthFuture(ioSession.getRemoteAddress(),
futureLock);
- authFuture.setAuthed(false);
signalSessionCreated(ioSession);
@@ -124,9 +123,17 @@ public class ClientSessionImpl extends
AbstractClientSession {
ClientUserAuthService authService = getUserAuthService();
synchronized (sessionLock) {
String serviceName = nextServiceName();
- authFuture = ValidateUtils.checkNotNull(
+ 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]