Permalink
Browse files

Namespace fixes boost::system and darner::log

  • Loading branch information...
1 parent fe2376a commit 1541f5cb88fb717d16e398361608eabbc9b46f91 @nipuman nipuman committed Aug 31, 2013
Showing with 30 additions and 30 deletions.
  1. +9 −9 src/main.cpp
  2. +10 −10 src/net/handler.cpp
  3. +2 −2 src/queue/iqstream.cpp
  4. +3 −3 src/queue/oqstream.cpp
  5. +3 −3 src/queue/queue.cpp
  6. +3 −3 src/util/log.cpp
View
@@ -97,14 +97,14 @@ int main(int argc, char * argv[])
return 1;
}
- log::init(vm.count("debug"));
+ darner::log::init(vm.count("debug"));
- log::INFO("darner: queue server");
- log::INFO("build: %1% (%2%) v%3% (c) Wavii, Inc.", __DATE__, __TIME__, DARNER_VERSION);
- log::INFO("listening on port: %1%", port);
- log::INFO("data dir: %1%", data_path);
+ darner::log::INFO("darner: queue server");
+ darner::log::INFO("build: %1% (%2%) v%3% (c) Wavii, Inc.", __DATE__, __TIME__, DARNER_VERSION);
+ darner::log::INFO("listening on port: %1%", port);
+ darner::log::INFO("data dir: %1%", data_path);
if (vm.count("debug"))
- log::INFO("debug logging is turned ON");
+ darner::log::INFO("debug logging is turned ON");
// TODO: we're doing some manual pthread/signal stuff here
// migrate to signal_set when we are ready to use boost 1.47
@@ -114,7 +114,7 @@ int main(int argc, char * argv[])
sigset_t old_mask;
pthread_sigmask(SIG_BLOCK, &new_mask, &old_mask);
- log::INFO("starting up");
+ darner::log::INFO("starting up");
server srv(data_path, port);
@@ -132,11 +132,11 @@ int main(int argc, char * argv[])
sigwait(&wait_mask, &sig);
// Stop the server.
- log::INFO("received signal. stopping server and finishing work.");
+ darner::log::INFO("received signal. stopping server and finishing work.");
srv.stop(); // stop accepting, wait for connections to all close out
- log::INFO("shut down. ciao.");
+ darner::log::INFO("shut down. ciao.");
return 0;
}
View
@@ -33,18 +33,18 @@ void handler::start()
++stats_.conns_opened;
socket_.set_option(ip::tcp::no_delay(true));
- read_request(system::error_code(), 0);
+ read_request(boost::system::error_code(), 0);
}
-void handler::read_request(const system::error_code& e, size_t bytes_transferred)
+void handler::read_request(const boost::system::error_code& e, size_t bytes_transferred)
{
if (e)
return error("read_request", e);
async_read_until(socket_, in_, '\n', bind(&handler::parse_request, shared_from_this(), _1, _2));
}
-void handler::parse_request(const system::error_code& e, size_t bytes_transferred)
+void handler::parse_request(const boost::system::error_code& e, size_t bytes_transferred)
{
if (e == error::eof && !in_.size()) // clean close by client?
return;
@@ -124,7 +124,7 @@ void handler::set()
bind(&handler::set_on_read_chunk, shared_from_this(), _1, _2));
}
-void handler::set_on_read_chunk(const system::error_code& e, size_t bytes_transferred)
+void handler::set_on_read_chunk(const boost::system::error_code& e, size_t bytes_transferred)
{
if (e)
return error("set_on_read_chunk", e);
@@ -150,7 +150,7 @@ void handler::set_on_read_chunk(const system::error_code& e, size_t bytes_transf
{
push_stream_.write(buf_);
}
- catch (const system::system_error& ex)
+ catch (const boost::system::system_error& ex)
{
return error("set_on_read_chunk", ex);
}
@@ -183,7 +183,7 @@ void handler::get()
{
pop_stream_.close(req_.get_close);
}
- catch (const system::system_error& ex)
+ catch (const boost::system::system_error& ex)
{
return error("get", ex);
}
@@ -206,7 +206,7 @@ void handler::get()
{
pop_stream_.read(buf_);
}
- catch (const system::system_error& ex)
+ catch (const boost::system::system_error& ex)
{
return error("get", ex);
}
@@ -222,7 +222,7 @@ void handler::get()
{
pop_stream_.close(!req_.get_peek);
}
- catch (const system::system_error& ex)
+ catch (const boost::system::system_error& ex)
{
return error("get_on_write_chunk", ex, false);
}
@@ -261,7 +261,7 @@ void handler::get_on_write_chunk(const boost::system::error_code& e, size_t byte
{
pop_stream_.close(!req_.get_peek);
}
- catch (const system::system_error& ex)
+ catch (const boost::system::system_error& ex)
{
return error("get_on_write_chunk", ex, false);
}
@@ -276,7 +276,7 @@ void handler::get_on_write_chunk(const boost::system::error_code& e, size_t byte
{
pop_stream_.read(buf_);
}
- catch (const system::system_error& ex)
+ catch (const boost::system::system_error& ex)
{
return error("get_on_write_chunk", ex, false);
}
View
@@ -15,7 +15,7 @@ iqstream::~iqstream()
bool iqstream::open(shared_ptr<queue> queue)
{
if (queue_)
- throw system::system_error(asio::error::already_open); // can't open what's open
+ throw boost::system::system_error(asio::error::already_open); // can't open what's open
if (!queue->pop_begin(id_))
return false;
@@ -32,7 +32,7 @@ void iqstream::read(string& result)
{
// not open or already read past end
if (!queue_ || chunk_pos_ >= header_.end)
- throw system::system_error(asio::error::eof);
+ throw boost::system::system_error(asio::error::eof);
if (!chunk_pos_) // first read? check if there's a header
{
View
@@ -32,7 +32,7 @@ oqstream::~oqstream()
void oqstream::open(boost::shared_ptr<queue> queue, queue::size_type chunks_count, bool sync)
{
if (queue_) // already open? that's a paddlin'
- throw system::system_error(asio::error::already_open);
+ throw boost::system::system_error(asio::error::already_open);
sync_ = sync;
queue_ = queue;
@@ -45,7 +45,7 @@ void oqstream::open(boost::shared_ptr<queue> queue, queue::size_type chunks_coun
void oqstream::write(const std::string& chunk)
{
if (!queue_ || chunk_pos_ == header_.end)
- throw system::system_error(asio::error::eof);
+ throw boost::system::system_error(asio::error::eof);
if (header_.end <= 1) // just one chunk? push it on
queue_->push(id_, chunk, sync_);
@@ -65,7 +65,7 @@ void oqstream::write(const std::string& chunk)
void oqstream::cancel()
{
if (!queue_)
- throw system::system_error(asio::error::eof); // not gon' do it
+ throw boost::system::system_error(asio::error::eof); // not gon' do it
if (header_.end > 1) // multi-chunk? erase them
queue_->erase_chunks(header_);
View
@@ -165,7 +165,7 @@ void queue::pop_read(std::string& result_item, header_type& result_header, id_ty
else if (result_item[result_item.size() - 2] == '\0') // \0 \0 means escaped \0
result_item.resize(result_item.size() - 1);
else
- throw system::system_error(system::errc::io_error,
+ throw boost::system::system_error(boost::system::errc::io_error,
boost::asio::error::get_system_category()); // anything else is bad data
}
}
@@ -243,15 +243,15 @@ void queue::wake_up()
}
}
-void queue::waiter_wakeup(const system::error_code& e, ptr_list<queue::waiter>::iterator waiter_it)
+void queue::waiter_wakeup(const boost::system::error_code& e, ptr_list<queue::waiter>::iterator waiter_it)
{
if (waiter_it == wake_up_it_) // did we time out on the next waiter in line? too bad.
++wake_up_it_;
ptr_list<waiter>::auto_type waiter = waiters_.release(waiter_it);
if (!returned_.empty() || queue_tail_.id < queue_head_.id)
- waiter->cb(system::error_code());
+ waiter->cb(boost::system::error_code());
else
waiter->cb(asio::error::timed_out);
}
View
@@ -9,18 +9,18 @@ using namespace boost;
using namespace boost::posix_time;
using namespace darner;
-log::log(mutex& mutex, ostream& out, const string& tag)
+darner::log::log(mutex& mutex, ostream& out, const string& tag)
: mutex_(mutex), out_(out), tag_(tag), enabled_(false)
{
}
-void log::enable(bool enabled)
+void darner::log::enable(bool enabled)
{
mutex::scoped_lock lock(mutex_);
enabled_ = enabled;
}
-void log::operator()(const string& format) const
+void darner::log::operator()(const string& format) const
{
if (!enabled_)
return;

0 comments on commit 1541f5c

Please sign in to comment.