Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
0.8.0
-
None
Description
One problem I found when implementing my service path was that ClientSessionImpl.waitFor wants to root around in the internals of UserAuthService to determine if the server is waiting for user authentication.
This patch is a partial back port of the changes I made to address that problem. Instead of using waitFor(WAIT_AUTH), the authentication code can directly wait on the AuthFuture returned vis:
AuthFuture authFuture;
do {
if (hasKeys)
else
{ System.out.print("Password:"); BufferedReader r = new BufferedReader(new InputStreamReader(System.in)); String password = r.readLine(); authFuture = session.authPassword(login, password); } authFuture.await();
} while (authFuture.isFailure());
if (!authFuture.isSuccess())
looking at the details:
- it factors out the duplicated code that was handling the wait for the server, and processing server/client messages
- if the connection fails, that's reported by getException()!=null and everything else being false.
- the internals also authFuture to wait for the server (just like the above)
- even makes it possible to delete WAIT_AUTH if so desired