Skip to content

Commit 5a53d2d

Browse files
committed
Update the relevant test case accordingly
1 parent 08d3d21 commit 5a53d2d

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

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

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

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

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

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

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

0 commit comments

Comments
 (0)