Page MenuHomePhabricator

[avalanche] Create an event loop facility.
ClosedPublic

Authored by deadalnix on Nov 11 2018, 14:22.

Details

Summary

Avalanche will need to pool peers on a regular basis, which require an event loop. This introduces the event loop, but it does nothing so far.

Depends on D2042

Test Plan
make check

Added unit tests.

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

deadalnix created this revision.Nov 11 2018, 14:22
Herald added a reviewer: Restricted Project. · View Herald TranscriptNov 11 2018, 14:22
deadalnix changed the visibility from "Public (No Login Required)" to "Restricted Project (Project)".Nov 11 2018, 14:22
deadalnix edited the summary of this revision. (Show Details)
jasonbcox requested changes to this revision.Nov 11 2018, 23:20
jasonbcox added a subscriber: jasonbcox.
jasonbcox added inline comments.
src/avalanche.cpp
61 ↗(On Diff #5750)

MILISECONDS -> MILLISECONDS

Comment says every 20ms, so this should be 20 not 10 (or just fix the comment).

76 ↗(On Diff #5750)

This statement can be more concise:

if (stopRequest) {
    // A stop request was made.
    LOCK(cs_running);
    running = false;
    cond_running.notify_all();
}
return running;
src/test/avalanche_tests.cpp
179 ↗(On Diff #5750)

taht -> , so or , so that

This revision now requires changes to proceed.Nov 11 2018, 23:20
deadalnix marked an inline comment as done.Nov 11 2018, 23:35
deadalnix added inline comments.
src/avalanche.cpp
76 ↗(On Diff #5750)

More concise and also incorrect.

deadalnix updated this revision to Diff 5757.Nov 11 2018, 23:47

Fix various typos and inconsistent comments

Fabien added a subscriber: Fabien.Nov 12 2018, 15:55
Fabien added inline comments.
src/avalanche.cpp
81 ↗(On Diff #5757)

You may add braces surrounding LOCK and running=false to (slightly) reduce the scope of the lock.

schancel accepted this revision.Nov 12 2018, 21:02
jasonbcox accepted this revision.Nov 12 2018, 21:51
This revision is now accepted and ready to land.Nov 12 2018, 21:51
deadalnix marked an inline comment as done.Nov 16 2018, 18:16
deadalnix added inline comments.
src/avalanche.cpp
81 ↗(On Diff #5757)

That would introduce a race condition.

deadalnix changed the visibility from "Restricted Project (Project)" to "Public (No Login Required)".Nov 21 2018, 13:15
deadalnix updated this revision to Diff 5980.Nov 21 2018, 16:12

Fix comments

deadalnix requested review of this revision.Nov 21 2018, 17:06
Fabien accepted this revision.Nov 22 2018, 18:22
This revision is now accepted and ready to land.Nov 22 2018, 18:22
This revision was automatically updated to reflect the committed changes.