summaryrefslogtreecommitdiff
path: root/src/network/poller.cpp
diff options
context:
space:
mode:
authorFlorent Le Coz <louiz@louiz.org>2014-02-08 07:59:02 +0100
committerFlorent Le Coz <louiz@louiz.org>2014-02-08 07:59:02 +0100
commitda85617428af0c35e9c5e7db21ec8a613ddd8b7c (patch)
tree1a8539e77b1d0b7e3e4e51965a2dfee32092af0a /src/network/poller.cpp
parentc8b41d5e350354881caa933ab363a2e90f991524 (diff)
downloadbiboumi-da85617428af0c35e9c5e7db21ec8a613ddd8b7c.tar.gz
biboumi-da85617428af0c35e9c5e7db21ec8a613ddd8b7c.tar.bz2
biboumi-da85617428af0c35e9c5e7db21ec8a613ddd8b7c.tar.xz
biboumi-da85617428af0c35e9c5e7db21ec8a613ddd8b7c.zip
Use strerror and log_error instead of perrror
Diffstat (limited to 'src/network/poller.cpp')
-rw-r--r--src/network/poller.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/network/poller.cpp b/src/network/poller.cpp
index 66b73f8..a157da9 100644
--- a/src/network/poller.cpp
+++ b/src/network/poller.cpp
@@ -16,7 +16,7 @@ Poller::Poller()
this->epfd = ::epoll_create1(0);
if (this->epfd == -1)
{
- perror("epoll");
+ log_error("epoll failed: " << strerror(errno));
throw std::runtime_error("Could not create epoll instance");
}
#endif
@@ -47,7 +47,7 @@ void Poller::add_socket_handler(std::shared_ptr<SocketHandler> socket_handler)
const int res = ::epoll_ctl(this->epfd, EPOLL_CTL_ADD, socket_handler->get_socket(), &event);
if (res == -1)
{
- perror("epoll_ctl");
+ log_error("epoll_ctl failed: " << strerror(errno));
throw std::runtime_error("Could not add socket to epoll");
}
#endif
@@ -79,7 +79,7 @@ void Poller::remove_socket_handler(const socket_t socket)
const int res = ::epoll_ctl(this->epfd, EPOLL_CTL_DEL, socket, nullptr);
if (res == -1)
{
- perror("epoll_ctl");
+ log_error("epoll_ctl failed: " << strerror(errno));
throw std::runtime_error("Could not remove socket from epoll");
}
#endif
@@ -102,7 +102,7 @@ void Poller::watch_send_events(SocketHandler* socket_handler)
const int res = ::epoll_ctl(this->epfd, EPOLL_CTL_MOD, socket_handler->get_socket(), &event);
if (res == -1)
{
- perror("epoll_ctl");
+ log_error("epoll_ctl failed: " << strerror(errno));
throw std::runtime_error("Could not modify socket flags in epoll");
}
#endif
@@ -125,7 +125,7 @@ void Poller::stop_watching_send_events(SocketHandler* socket_handler)
const int res = ::epoll_ctl(this->epfd, EPOLL_CTL_MOD, socket_handler->get_socket(), &event);
if (res == -1)
{
- perror("epoll_ctl");
+ log_error("epoll_ctl failed: " << strerror(errno));
throw std::runtime_error("Could not modify socket flags in epoll");
}
#endif
@@ -141,7 +141,7 @@ int Poller::poll(const std::chrono::milliseconds& timeout)
{
if (errno == EINTR)
return true;
- perror("poll");
+ log_error("poll failed: " << strerror(errno));
throw std::runtime_error("Poll failed");
}
// We cannot possibly have more ready events than the number of fds we are
@@ -173,7 +173,7 @@ int Poller::poll(const std::chrono::milliseconds& timeout)
{
if (errno == EINTR)
return 0;
- perror("epoll_wait");
+ log_error("epoll wait: " << strerror(errno));
throw std::runtime_error("Epoll_wait failed");
}
for (int i = 0; i < nb_events; ++i)