mirror of https://github.com/Sonarr/Sonarr
Fixed curl multithreaded access.
This commit is contained in:
parent
7bc4249ede
commit
786e0b825a
|
@ -39,6 +39,8 @@ namespace NzbDrone.Common.Http
|
||||||
}
|
}
|
||||||
|
|
||||||
public HttpResponse GetResponse(HttpRequest httpRequest, HttpWebRequest webRequest)
|
public HttpResponse GetResponse(HttpRequest httpRequest, HttpWebRequest webRequest)
|
||||||
|
{
|
||||||
|
lock (CurlGlobalHandle.Instance)
|
||||||
{
|
{
|
||||||
Stream responseStream = new MemoryStream();
|
Stream responseStream = new MemoryStream();
|
||||||
Stream headerStream = new MemoryStream();
|
Stream headerStream = new MemoryStream();
|
||||||
|
@ -91,6 +93,7 @@ namespace NzbDrone.Common.Http
|
||||||
|
|
||||||
return new HttpResponse(httpRequest, httpHeader, responseData, (HttpStatusCode)curlEasy.ResponseCode);
|
return new HttpResponse(httpRequest, httpHeader, responseData, (HttpStatusCode)curlEasy.ResponseCode);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private CurlSlist SerializeHeaders(HttpWebRequest webRequest)
|
private CurlSlist SerializeHeaders(HttpWebRequest webRequest)
|
||||||
{
|
{
|
||||||
|
@ -205,6 +208,8 @@ namespace NzbDrone.Common.Http
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Initialize()
|
public bool Initialize()
|
||||||
|
{
|
||||||
|
lock (CurlGlobalHandle.Instance)
|
||||||
{
|
{
|
||||||
if (_initialized)
|
if (_initialized)
|
||||||
return _available;
|
return _available;
|
||||||
|
@ -214,6 +219,7 @@ namespace NzbDrone.Common.Http
|
||||||
|
|
||||||
return _available;
|
return _available;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected override bool ReleaseHandle()
|
protected override bool ReleaseHandle()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue