diff options
author | lloyd <[email protected]> | 2015-03-18 10:10:09 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2015-03-18 10:10:09 +0000 |
commit | 1c5c28f2e8a605c0429bacd49fc8cacbbb50377a (patch) | |
tree | cd955920104c7d1d3db0cd56af7d350a04124de9 /src/lib/entropy/proc_walk | |
parent | 827080864508e03d796c5138b34d563977d693bb (diff) |
Remove the shared IO buffer from EntropySource_Accumulator.
Instead each source that needs a buffer maintains their own.
Diffstat (limited to 'src/lib/entropy/proc_walk')
-rw-r--r-- | src/lib/entropy/proc_walk/proc_walk.cpp | 8 | ||||
-rw-r--r-- | src/lib/entropy/proc_walk/proc_walk.h | 1 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/entropy/proc_walk/proc_walk.cpp b/src/lib/entropy/proc_walk/proc_walk.cpp index 55affda40..1501f0774 100644 --- a/src/lib/entropy/proc_walk/proc_walk.cpp +++ b/src/lib/entropy/proc_walk/proc_walk.cpp @@ -120,7 +120,7 @@ void ProcWalking_EntropySource::poll(Entropy_Accumulator& accum) if(!m_dir) m_dir.reset(new Directory_Walker(m_path)); - secure_vector<byte>& io_buffer = accum.get_io_buffer(4096); + m_buf.resize(4096); for(size_t i = 0; i != MAX_FILES_READ_PER_POLL; ++i) { @@ -133,13 +133,13 @@ void ProcWalking_EntropySource::poll(Entropy_Accumulator& accum) break; } - ssize_t got = ::read(fd, &io_buffer[0], io_buffer.size()); + ssize_t got = ::read(fd, &m_buf[0], m_buf.size()); ::close(fd); if(got > 0) - accum.add(&io_buffer[0], got, ENTROPY_ESTIMATE); + accum.add(&m_buf[0], got, ENTROPY_ESTIMATE); - if(accum.polling_goal_achieved()) + if(accum.polling_finished()) break; } } diff --git a/src/lib/entropy/proc_walk/proc_walk.h b/src/lib/entropy/proc_walk/proc_walk.h index 079fdc2cd..939feb112 100644 --- a/src/lib/entropy/proc_walk/proc_walk.h +++ b/src/lib/entropy/proc_walk/proc_walk.h @@ -37,6 +37,7 @@ class ProcWalking_EntropySource : public EntropySource const std::string m_path; std::mutex m_mutex; std::unique_ptr<File_Descriptor_Source> m_dir; + secure_vector<byte> m_buf; }; } |