Clean up security token transport if connection procedure failed

This commit is contained in:
Vincent Breitmoser
2018-07-15 12:29:06 +02:00
parent fbbc77335b
commit a3021bbd83

View File

@@ -103,6 +103,7 @@ public class SecurityTokenConnection {
*/
@VisibleForTesting
void connectToDevice(Context context) throws IOException {
try {
// Connect on transport layer
transport.connect();
@@ -125,6 +126,10 @@ public class SecurityTokenConnection {
isPw3Validated = false;
smEstablishIfAvailable(context);
} catch (IOException e) {
transport.release();
throw e;
}
}
@VisibleForTesting