Skip to content

Commit

Permalink
bugfix: BufferingAgent
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Williams committed May 5, 2015
1 parent 5370e55 commit 64f4041
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/lib/BufferingAgent.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class BufferingAgent : public QThread
unsinged int _max_queue_length;
bool _halt;
pelican::AbstractDataClient& _client;
std::deque<DataBlobHash&> _queue; // objects ready for serving
std::deque<DataBlobHash*> _queue; // objects ready for serving
QList<DataBlobHash> _buffer_objects;
LockingContainer<DataBlobHash> _buffer;
};
Expand Down
9 changes: 5 additions & 4 deletions src/lib/src/BufferingAgent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ BufferingAgent::BufferingAgent(AbstractDataClient& client)

BufferingAgent::~BufferingAgent()
{
_halt = false;
_halt = true;
if(_!queue.empty()) _buffer.unlock(_queue.front()); // ensure to remove any block
}

void BufferingAgent::run() {
Expand All @@ -30,7 +31,7 @@ void BufferingAgent::run() {
DataBlobHash& hash = *(_buffer->next()); // blocks until ready
if(_halt) return;
_client.getData(hash);
_queue.push_back(hash);
_queue.push_back(&hash);
}
}

Expand All @@ -39,8 +40,8 @@ void BufferingAgent::getData(DataBlobHash& hash) {
do{}
while(_queue.empty());

hash.swap(_queue.front()); // TODO verify this is doing what we think its doing
_buffer.unlock(&(_queue.front()));
hash.swap(*_queue.front()); // TODO verify this is doing what we think its doing
_buffer.unlock(_queue.front());
_queue.pop_front();
}

Expand Down

0 comments on commit 64f4041

Please sign in to comment.