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

split bind and listen for dynamic port reading #29

Merged
merged 2 commits into from
Dec 14, 2024
Merged

split bind and listen for dynamic port reading #29

merged 2 commits into from
Dec 14, 2024

Conversation

hazel-sudz
Copy link
Collaborator

No description provided.

Comment on lines +134 to 136
router2.bind().await?;
router2.listen().await?;
Ok(())
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

bind now returns the ip/port and later call to listen() must be made to actually listen. This way implementers of router (such as read shard) are able to know the port they are listening on while still supporting dynamic port assignment.

Comment on lines -233 to 235
let client3 = info_server.get_router_client();
let client4 = info_server.get_router_client();
let router_clone_3 = Arc::clone(&info_router);
let client3 = read_shard_server.get_router_client();
let client4 = read_shard_server.get_router_client();
let router_clone_3 = read_shard_router.clone();
tokio::spawn({
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think this is a typo in read_shard

let read_shard = ReadShard::new(SocketAddrV6::new(Ipv6Addr::LOCALHOST, 8084, 0, 0));
let read_shard = ReadShard::new();

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is now no longer needed

@hazel-sudz hazel-sudz requested a review from Rixhee December 14, 2024 20:33
@Rixhee Rixhee merged commit f361f87 into main Dec 14, 2024
@Rixhee Rixhee deleted the dynport branch December 14, 2024 20:40
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