8000 Add lock to credential cache modifications · sitereactor/libgit2sharp@665eb5f · GitHub
[go: up one dir, main page]

Skip to content

Commit 665eb5f

Browse files
committed
Add lock to credential cache modifications
1 parent a514c5f commit 665eb5f

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

LibGit2Sharp/Core/ManagedHttpSmartSubtransport.cs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,11 +186,17 @@ private HttpResponseMessage GetResponseWithRedirects()
186186

187187
if (cred is DefaultCredentials)
188188
{
189-
credentialCache.Add(url, scheme, CredentialCache.DefaultNetworkCredentials);
189+
lock (credentialCache)
190+
{
191+
credentialCache.Add(url, scheme, CredentialCache.DefaultNetworkCredentials);
192+
}
190193
}
191194
else if (cred is UsernamePasswordCredentials userpass)
192195
{
193-
credentialCache.Add(url, scheme, new NetworkCredential(userpass.Username, userpass.Password));
196+
lock (credentialCache)
197+
{
198+
credentialCache.Add(url, scheme, new NetworkCredential(userpass.Username, userpass.Password));
199+
}
194200
}
195201

196202
continue;

0 commit comments

Comments
 (0)
0