TheLastRefuge / Jarcon

🌐 Java remote console client for Battlefield servers
0 stars 0 forks source link

Login bug #7

Closed chris6366 closed 3 years ago

chris6366 commented 3 years ago

https://github.com/TheLastRefuge/Jarcon/blob/dd11e55d894f78ecfa2f7eedc2fbf4ea3f940534/src/test/java/gg/tlr/jarcon/TestEnv.java#L26-L27

client.login().get(); throws because JarconClient:doLogin is already called through client.connect().get();. On the second attempt it reads Status.LOGGED_IN while checking for Status.CONNECTED and then throws IllegalStateException. Several ways to fix but I'm not sure how you intended this.

ItsFlare commented 3 years ago

Oops. What would you say is the intuitive outcome for calling login when already logged in - return, return and warn, or throw?

chris6366 commented 3 years ago

Idempotent I'd say... if you attempt to close a Closeable that's already closed, it just returns. So if you attempt to login while already logged in, just return. At least that's what I do in the Battlelog library when it comes to logging in.