mirror of
https://github.com/zeek/zeek.git
synced 2025-10-02 14:48:21 +00:00
threading/Manager: Switch inf bucket from infinity() to max()
For uint64_t, std::numeric_limits<T>::has_infinity is false and infinity() actually returns 0. Use uint64_t's max() instead. We could cast to double and use the double infinity, but this seems reasonable, too. This was found while trying to provoke some pending messages and being confused why all but the "inf" bucket increased.
This commit is contained in:
parent
98480cf339
commit
c55b2ece8f
1 changed files with 4 additions and 3 deletions
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
#include "zeek/Event.h"
|
#include "zeek/Event.h"
|
||||||
#include "zeek/IPAddr.h"
|
#include "zeek/IPAddr.h"
|
||||||
|
@ -22,8 +24,7 @@ void HeartbeatTimer::Dispatch(double t, bool is_expire) {
|
||||||
|
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
static std::vector<uint64_t> pending_bucket_brackets = {1, 10, 100,
|
static std::vector<uint64_t> pending_bucket_brackets = {1, 10, 100, 1000, 10000, std::numeric_limits<uint64_t>::max()};
|
||||||
1000, 10000, std::numeric_limits<uint64_t>::infinity()};
|
|
||||||
|
|
||||||
Manager::Manager() {
|
Manager::Manager() {
|
||||||
DBG_LOG(DBG_THREADING, "Creating thread manager ...");
|
DBG_LOG(DBG_THREADING, "Creating thread manager ...");
|
||||||
|
@ -130,7 +131,7 @@ void Manager::InitPostScript() {
|
||||||
|
|
||||||
for ( auto upper_limit : pending_bucket_brackets ) {
|
for ( auto upper_limit : pending_bucket_brackets ) {
|
||||||
std::string upper_limit_str;
|
std::string upper_limit_str;
|
||||||
if ( upper_limit == std::numeric_limits<uint64_t>::infinity() )
|
if ( upper_limit == std::numeric_limits<uint64_t>::max() )
|
||||||
upper_limit_str = "inf";
|
upper_limit_str = "inf";
|
||||||
else
|
else
|
||||||
upper_limit_str = std::to_string(upper_limit);
|
upper_limit_str = std::to_string(upper_limit);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue