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

Enable setting target nodes to traffic generator #460

Merged
merged 4 commits into from
Dec 14, 2022

Conversation

Naphann
Copy link
Contributor

@Naphann Naphann commented Dec 13, 2022

Add functionality to set target nodes to application for traffic generator.

Example usecase

In .ini files, one can add

*.EndNode1.app.has_specific_recipients = true;
*.EndNode1.app.possible_recipients = [1, 2, 3]; // needs to be valid addresses inside the network

If app.has_specific_recipients is set to false. The behaviour of traffic generator will revert back to selecting a random node in the network as receiver.


This change is Reviewable

@Naphann Naphann requested a review from zigen December 13, 2022 18:12
Copy link
Contributor

@zigen zigen left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 5 files at r1, all commit messages.
Reviewable status: 3 of 5 files reviewed, 1 unresolved discussion (waiting on @Naphann)


quisp/modules/Application/Application.cc line 125 at r1 (raw file):

    // set self weight to 0; so we don't create self traffic
    temp_end_node_weight_map[my_address] = 0;
    end_node_weight_map = std::ref(temp_end_node_weight_map);

Why do we need this std::ref?
The instance is a local variable, and the end_node_weight_map is a member,
so if we access end_node_weight_map in other methods, is that safe?

Copy link
Contributor

@zigen zigen left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 5 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @Naphann)

Copy link
Contributor Author

@Naphann Naphann left a comment

Choose a reason for hiding this comment

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

Reviewable status: 4 of 5 files reviewed, 1 unresolved discussion (waiting on @zigen)


quisp/modules/Application/Application.cc line 125 at r1 (raw file):

Previously, zigen (Kentaro "zigen" Teramoto) wrote…

Why do we need this std::ref?
The instance is a local variable, and the end_node_weight_map is a member,
so if we access end_node_weight_map in other methods, is that safe?

I think I misunderstood what std::ref does. I was meaning to make a swap instead of copying the map.

Copy link
Contributor

@zigen zigen left a comment

Choose a reason for hiding this comment

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

:lgtm:

I confirmed it works with this configuration

**.app.has_specific_recipients = true
**.app.possible_recipients = [1]
**.EndNode2[0].is_initiator = true

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Naphann)

Copy link
Contributor Author

@Naphann Naphann left a comment

Choose a reason for hiding this comment

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

Thanks for the testing!

Reviewed 4 of 5 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Naphann)

@Naphann Naphann merged commit aa5c756 into master Dec 14, 2022
@Naphann Naphann deleted the targetable-traffic-generator branch December 14, 2022 10:21
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.

2 participants