Skip to content
Snippets Groups Projects
Commit 7958be88 authored by Eric Cano's avatar Eric Cano
Browse files

Added protection against negative timeouts in SocketPair::poll.

The maintenance handler provided a negative timeout when its round too long. This
led to infinitely sleeping on a poll instead of a timeout of 10s max.
parent 1e69a369
No related branches found
No related tags found
No related merge requests found
......@@ -24,6 +24,7 @@
#include <poll.h>
#include <memory>
#include <list>
#include <algorithm>
namespace cta { namespace server {
......@@ -98,6 +99,7 @@ void SocketPair::poll(pollMap& socketPairs, time_t timeout, Side sourceToPoll) {
fdsp->events = POLLIN;
fdsp++;
}
timeout = std::max(timeout, (time_t)0);
int rc=::poll(fds.get(), socketPairs.size(), timeout * 1000);
if (rc > 0) {
// We have readable fds, copy the results in the provided map
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment