Skip to content

Commit 2b9328d

Browse files
authored
Merge pull request #213 from Yubico/tim/revert-initial-three-seconds-delay-changes
Tim/revert initial three seconds delay changes
2 parents 0708bd8 + 40f0045 commit 2b9328d

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

Yubico.YubiKey/src/Yubico/YubiKey/ConnectionFactory.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,12 @@ private void WaitForReclaimTimeout(Transport newTransport)
154154
? TimeSpan.FromMilliseconds(100)
155155
: TimeSpan.FromSeconds(3.01);
156156

157-
// Skip waiting if the transport is already active or was previously None
158-
if (_device.LastActiveTransport == newTransport || _device.LastActiveTransport == Transport.None)
157+
// We're only affected by the reclaim timeout if we're switching USB transports.
158+
if (_device.LastActiveTransport == newTransport)
159159
{
160160
_log.LogDebug(
161161
"{Transport} transport is already active. No need to wait for reclaim.",
162162
_device.LastActiveTransport);
163-
_device.LastActiveTransport = newTransport;
164163
return;
165164
}
166165

Yubico.YubiKey/tests/integration/Yubico/YubiKey/ReclaimTimeoutTests.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ public void SwitchingBetweenTransports_ForcesThreeSecondWait()
9393
sw3.Stop();
9494

9595
const long expectedLapse = 3000;
96-
const long firstConnectionMaxTime = 100;
97-
Assert.True(sw1.ElapsedMilliseconds < firstConnectionMaxTime);
96+
Assert.True(sw1.ElapsedMilliseconds > expectedLapse);
9897
Assert.True(sw2.ElapsedMilliseconds > expectedLapse);
9998
Assert.True(sw3.ElapsedMilliseconds > expectedLapse);
10099
}

0 commit comments

Comments
 (0)