Commit bdd0c368 authored by Max Kellermann's avatar Max Kellermann

input/async: use class HugeAllocation

parent 91769d53
......@@ -23,17 +23,17 @@
#include "tag/Tag.hxx"
#include "thread/Cond.hxx"
#include "IOThread.hxx"
#include "util/HugeAllocator.hxx"
#include <assert.h>
#include <string.h>
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
......
......@@ -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<uint8_t> 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();
......
......@@ -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),
......
......@@ -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) {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment