summaryrefslogtreecommitdiff
path: root/louloulibs
diff options
context:
space:
mode:
authorlouiz’ <louiz@louiz.org>2016-10-12 20:51:46 +0200
committerlouiz’ <louiz@louiz.org>2016-10-12 21:00:05 +0200
commit5f2e4820df51374ddd61b68abf35f9ee75f5a117 (patch)
tree1539702802c115468d7b1b4a584fa7d599b01340 /louloulibs
parentc54f28d29d5f1d7a2bb973609beffbe5ad56d422 (diff)
downloadbiboumi-5f2e4820df51374ddd61b68abf35f9ee75f5a117.tar.gz
biboumi-5f2e4820df51374ddd61b68abf35f9ee75f5a117.tar.bz2
biboumi-5f2e4820df51374ddd61b68abf35f9ee75f5a117.tar.xz
biboumi-5f2e4820df51374ddd61b68abf35f9ee75f5a117.zip
Fix an off-by-one issue in the POLL code
Diffstat (limited to 'louloulibs')
-rw-r--r--louloulibs/network/poller.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/louloulibs/network/poller.cpp b/louloulibs/network/poller.cpp
index d341bb5..9868236 100644
--- a/louloulibs/network/poller.cpp
+++ b/louloulibs/network/poller.cpp
@@ -95,7 +95,7 @@ void Poller::remove_socket_handler(const socket_t socket)
void Poller::watch_send_events(SocketHandler* socket_handler)
{
#if POLLER == POLL
- for (size_t i = 0; i <= this->nfds; ++i)
+ for (size_t i = 0; i < this->nfds; ++i)
{
if (this->fds[i].fd == socket_handler->get_socket())
{
@@ -171,7 +171,7 @@ int Poller::poll(const std::chrono::milliseconds& timeout)
// We cannot possibly have more ready events than the number of fds we are
// watching
assert(static_cast<unsigned int>(nb_events) <= this->nfds);
- for (size_t i = 0; i <= this->nfds && nb_events != 0; ++i)
+ for (size_t i = 0; i < this->nfds && nb_events != 0; ++i)
{
auto socket_handler = this->socket_handlers.at(this->fds[i].fd);
if (this->fds[i].revents == 0)