Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Beacon clock fix #20

Merged
merged 2 commits into from
Jan 11, 2019
Merged

Beacon clock fix #20

merged 2 commits into from
Jan 11, 2019

Conversation

coreyker
Copy link
Contributor

@coreyker coreyker commented Nov 6, 2018

Fixed operator precedence. Compare numReplies to onlinePeers.size-1 instead of onlinePeers.size

@muellmusik muellmusik self-assigned this Jan 11, 2019
@muellmusik muellmusik merged commit ce4d0ad into muellmusik:master Jan 11, 2019
@@ -160,7 +160,7 @@ BeaconClock : TempoClock {
count = msg[2];
numReplies = msg[3];
onlinePeers = addrBook.onlinePeers;
if((name != addrBook.me.name && numReplies == onlinePeers.size) || (numReplies < 3 && (numReplies > 0) && numReplies == onlinePeers.size), { // ignore my own beacons if possible
if(((name != addrBook.me.name) && (numReplies == (onlinePeers.size-1))) || ((numReplies < 3) && (numReplies > 0) && (numReplies == onlinePeers.size)), { // ignore my own beacons if possible
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a note: this is a rather inefficient way of writing it. Maybe better, because this is a method that is called often:

if(
((name != addrBook.me.name) and: { numReplies == (onlinePeers.size-1) }) 
     or: { 
       (numReplies < 3) 
       and: { numReplies > 0 } 
       and: { numReplies == onlinePeers.size }  
      }
),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants