Skip to content
This repository has been archived by the owner on Apr 24, 2020. It is now read-only.

Updates to compile on debian/stretch #31

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,11 @@ ADD_EXECUTABLE(test
tests/main
)

FIND_PACKAGE(Boost 1.40.0 COMPONENTS thread system program_options unit_test_framework filesystem)
FIND_PACKAGE(Boost 1.40.0 COMPONENTS thread system program_options filesystem unit_test_framework)

# Explicitly list libraries for each Boost component to avoid linking server executable to the unit test library
TARGET_LINK_LIBRARIES(darner pthread ${Boost_THREAD_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} leveldb snappy)

TARGET_LINK_LIBRARIES(darner pthread ${Boost_LIBRARIES} leveldb snappy)
TARGET_LINK_LIBRARIES(db ${Boost_LIBRARIES})
TARGET_LINK_LIBRARIES(test pthread ${Boost_LIBRARIES} leveldb snappy)

Expand Down
4 changes: 2 additions & 2 deletions bench/db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ struct results
size_t sets_remaining;
};

class session : public enable_shared_from_this<session>
class session : public boost::enable_shared_from_this<session>
{
public:

typedef ip::tcp::socket socket_type;
typedef shared_ptr<session> ptr_type;
typedef boost::shared_ptr<session> ptr_type;

session(io_service& ios, results& _results, const string& host, size_t port, size_t bad_client_rate,
size_t action = 0)
Expand Down
2 changes: 1 addition & 1 deletion include/darner/queue/iqstream.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class iqstream
/*
* returns true if open
*/
operator bool() const { return queue_; }
operator bool() const { return static_cast<bool>(queue_); }

private:

Expand Down
4 changes: 2 additions & 2 deletions src/net/handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -228,12 +228,12 @@ void handler::get()
}
}
++stats_.items_dequeued;
array<const_buffer, 3> bufs = {{ buffer(header_buf_), buffer(buf_), buffer("\r\nEND\r\n", 7) }};
boost::array<const_buffer, 3> bufs = {{ buffer(header_buf_), buffer(buf_), buffer("\r\nEND\r\n", 7) }};
async_write(socket_, bufs, bind(&handler::read_request, shared_from_this(), _1, _2));
}
else
{
array<const_buffer, 2> bufs = {{ buffer(header_buf_), buffer(buf_) }};
boost::array<const_buffer, 2> bufs = {{ buffer(header_buf_), buffer(buf_) }};
async_write(socket_, bufs, bind(&handler::get_on_write_chunk, shared_from_this(), _1, _2));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/queue/iqstream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ iqstream::~iqstream()
queue_->pop_end(false, id_, header_);
}

bool iqstream::open(shared_ptr<queue> queue)
bool iqstream::open(boost::shared_ptr<queue> queue)
{
if (queue_)
throw system::system_error(asio::error::already_open); // can't open what's open
Expand Down
11 changes: 6 additions & 5 deletions tests/queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ BOOST_FIXTURE_TEST_CASE( test_pop_wait, fixtures::basic_queue )
"elevator sometimes, my 7 floor sanctuary";
posix_time::ptime beg = boost::posix_time::microsec_clock::local_time();
deadline_timer timer(ios_, posix_time::milliseconds(10));
timer.async_wait(bind(&fixtures::basic_queue::delayed_push, this, ref(value), _1));
timer.async_wait(bind(&fixtures::basic_queue::delayed_push, this, boost::ref(value), _1));
queue_->wait(100, wait_cb_);
ios_.run();
boost::posix_time::ptime end = boost::posix_time::microsec_clock::local_time();
Expand All @@ -56,9 +56,9 @@ BOOST_FIXTURE_TEST_CASE( test_multiple_pop_wait, fixtures::basic_queue )
string value2 = "Hotel robe got me feeling like a Sheik";
posix_time::ptime beg = boost::posix_time::microsec_clock::local_time();
deadline_timer timer1(ios_, posix_time::milliseconds(10));
timer1.async_wait(bind(&fixtures::basic_queue::delayed_push, this, ref(value1), _1));
timer1.async_wait(bind(&fixtures::basic_queue::delayed_push, this, boost::ref(value1), _1));
deadline_timer timer2(ios_, posix_time::milliseconds(20));
timer2.async_wait(bind(&fixtures::basic_queue::delayed_push, this, ref(value2), _1));
timer2.async_wait(bind(&fixtures::basic_queue::delayed_push, this, boost::ref(value2), _1));
queue_->wait(100, wait_cb_);
queue_->wait(100, wait_cb_);
ios_.run();
Expand All @@ -74,7 +74,7 @@ BOOST_FIXTURE_TEST_CASE( test_pop_wait_race, fixtures::basic_queue )
{
string value = "Fur pillows are hard to actually sleep on";
deadline_timer timer(ios_, posix_time::milliseconds(80));
timer.async_wait(bind(&fixtures::basic_queue::delayed_push_block, this, ref(value), _1));
timer.async_wait(bind(&fixtures::basic_queue::delayed_push_block, this, boost::ref(value), _1));
queue_->wait(100, wait_cb_);
ios_.run();

Expand All @@ -86,7 +86,7 @@ BOOST_FIXTURE_TEST_CASE( test_pop_wait_timeout, fixtures::basic_queue )
{
string value = "Classical music is tight yo";
deadline_timer timer(ios_, posix_time::milliseconds(50));
timer.async_wait(bind(&fixtures::basic_queue::delayed_push, this, ref(value), _1));
timer.async_wait(bind(&fixtures::basic_queue::delayed_push, this, boost::ref(value), _1));
queue_->wait(10, wait_cb_);
ios_.run();

Expand All @@ -101,6 +101,7 @@ BOOST_FIXTURE_TEST_CASE( test_queue_close_reopen, fixtures::basic_queue )

oqs_.open(queue_, 1);
oqs_.write(value);
queue_.reset();
queue_.reset(new darner::queue(ios_, (tmp_ / "queue").string()));
BOOST_REQUIRE_EQUAL(queue_->count(), 1);

Expand Down