diff --git a/src/input/AsyncInputStream.cxx b/src/input/AsyncInputStream.cxx index 308214f2b..f351bbc38 100644 --- a/src/input/AsyncInputStream.cxx +++ b/src/input/AsyncInputStream.cxx @@ -23,17 +23,17 @@ #include "tag/Tag.hxx" #include "thread/Cond.hxx" #include "IOThread.hxx" -#include "util/HugeAllocator.hxx" #include #include AsyncInputStream::AsyncInputStream(const char *_url, Mutex &_mutex, Cond &_cond, - void *_buffer, size_t _buffer_size, + size_t _buffer_size, size_t _resume_at) :InputStream(_url, _mutex, _cond), DeferredMonitor(io_thread_get()), - buffer((uint8_t *)_buffer, _buffer_size), + allocation(_buffer_size), + buffer((uint8_t *)allocation.get(), _buffer_size), resume_at(_resume_at), open(true), paused(false), @@ -45,7 +45,6 @@ AsyncInputStream::~AsyncInputStream() delete tag; buffer.Clear(); - HugeFree(buffer.Write().data, buffer.GetCapacity()); } void diff --git a/src/input/AsyncInputStream.hxx b/src/input/AsyncInputStream.hxx index 49b1cc465..5f229ee81 100644 --- a/src/input/AsyncInputStream.hxx +++ b/src/input/AsyncInputStream.hxx @@ -22,6 +22,7 @@ #include "InputStream.hxx" #include "event/DeferredMonitor.hxx" +#include "util/HugeAllocator.hxx" #include "util/CircularBuffer.hxx" #include "util/Error.hxx" @@ -36,6 +37,8 @@ class AsyncInputStream : public InputStream, private DeferredMonitor { NONE, SCHEDULED, PENDING }; + HugeAllocation allocation; + CircularBuffer buffer; const size_t resume_at; @@ -68,7 +71,7 @@ public: */ AsyncInputStream(const char *_url, Mutex &_mutex, Cond &_cond, - void *_buffer, size_t _buffer_size, + size_t _buffer_size, size_t _resume_at); virtual ~AsyncInputStream(); diff --git a/src/input/plugins/CurlInputPlugin.cxx b/src/input/plugins/CurlInputPlugin.cxx index 1b5b152a1..98df83a25 100644 --- a/src/input/plugins/CurlInputPlugin.cxx +++ b/src/input/plugins/CurlInputPlugin.cxx @@ -32,7 +32,6 @@ #include "util/ASCII.hxx" #include "util/StringUtil.hxx" #include "util/NumberParser.hxx" -#include "util/HugeAllocator.hxx" #include "util/Error.hxx" #include "util/Domain.hxx" #include "Log.hxx" @@ -75,7 +74,6 @@ struct CurlInputStream final : public AsyncInputStream { CurlInputStream(const char *_url, Mutex &_mutex, Cond &_cond) :AsyncInputStream(_url, _mutex, _cond, - HugeAllocate(CURL_MAX_BUFFERED), CURL_MAX_BUFFERED, CURL_RESUME_AT), request_headers(nullptr), diff --git a/src/input/plugins/NfsInputPlugin.cxx b/src/input/plugins/NfsInputPlugin.cxx index 13d94831a..b6d4a204d 100644 --- a/src/input/plugins/NfsInputPlugin.cxx +++ b/src/input/plugins/NfsInputPlugin.cxx @@ -24,7 +24,6 @@ #include "lib/nfs/Domain.hxx" #include "lib/nfs/Glue.hxx" #include "lib/nfs/FileReader.hxx" -#include "util/HugeAllocator.hxx" #include "util/StringCompare.hxx" #include "util/Error.hxx" @@ -50,7 +49,6 @@ class NfsInputStream final : public AsyncInputStream, NfsFileReader { public: NfsInputStream(const char *_uri, Mutex &_mutex, Cond &_cond) :AsyncInputStream(_uri, _mutex, _cond, - HugeAllocate(NFS_MAX_BUFFERED), NFS_MAX_BUFFERED, NFS_RESUME_AT), reconnect_on_resume(false), reconnecting(false) {}