Commit graph

8 commits

Author SHA1 Message Date
Jason Rhinelander 13409ad00e
run clang format 2023-04-13 17:15:12 -03:00
Jason Rhinelander c9934b9f5f
Change most oxen::log::whatever to log::whatever
oxen::log::info(...), etc. are a bit too verbose; this simplifies them
to just `log::info(...)`, etc. by aliasing the `oxen::log` namespace
into most of the common namespaces we use in core.

This result is usage that is shorter but also reads better:

    oxen::log::info(logcat, "blah: {}", 42);

    log::info(logcat, "blah: {}", 42);
2022-10-17 13:41:43 -03:00
Sean Darcy d7992b5940
Logging Refactor
This replaces the current epee logging system with our oxen::log
library. It replaces the easylogging library with spdlog, removes the
macros and replaces with functions and standardises how we call the
logs.
2022-10-17 13:41:10 -03:00
Jason Rhinelander 2c96fa0f6c Don't sort an already-sorted vector
The swarm_ids are std::map keys, which means they are already sorted.

Put an assert in just to be paranoid.
2021-04-19 00:14:47 -03:00
Jason Rhinelander 1fb10d8b1d Fix get_new_swarm_id() returning MAX_ID/2 when single swarm
The important part here is removing this line:

    if (swarm_to_snodes.size() == 1) return MAX_ID / 2;

because, if we end up in a case where we have only one swarm and it
*already* has that ID (e.g. create 2, which will be [MAX/2,0] then drop
0) then this returns a swarm_id that already exists, which is bad
because then we fail to insert the new swarm, a service node gets left
with an unassigned swarm id, and that then causes issues in SS because
that node thinks it is deactivated because it doesn't have a swarm id
(yet it *is* in the active nodes list, so other network members still
try to talk to it).
2021-04-18 23:47:22 -03:00
Sean Darcy 432dc319a9 executable names changed 2021-01-04 14:19:42 +11:00
Jason Rhinelander 8090ee3481 Move randomness into new common/random.h
This adds a thread-local, pre-seeded rng at `tools::rng` (to avoid the
multiple places we are creating + seeding such an RNG currently).

This also moves the portable uniform value and generic shuffle code
there as well as neither function is specific to service nodes and this
seems a logical place for them.
2019-11-27 14:07:52 -04:00
sachaaaaa 18208cf138 Bufferless swarm assignment logic (#518)
* unit tests and core tests for new queueless swarm assignment logic

* new bufferless swarm assignment logic

* new lines

* Address reviews

* Improve node stealing logic

* unit tests for additional functions

* get_excess_pool to return early if the threshold is lower than MIN_SWARM_SIZE

* Address reviews

* another round of reviews

* Move new_swarm_vector inside loop

* Rebase changes: moved get_new_swarm_id to service_node_swarm.cpp

* reserve vector size for all_ids in get_new_swarm_id
2019-04-08 12:03:47 +10:00