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

[1.0.2] P2P: Resolve on reconnect - Take 2 #853

Merged
merged 8 commits into from
Oct 2, 2024
Merged

Conversation

heifner
Copy link
Member

@heifner heifner commented Oct 1, 2024

Resolve address on reconnect. (Take 2, See #825)

Instead of:

info  2024-09-25T21:50:50.686 net-1     net_plugin.cpp:2797           operator()           ] connection failed to p2p.telos-bad.zenblocks.io:9876, Element not found
info  2024-09-25T21:50:50.686 net-1     net_plugin.cpp:1461           _close               ] ["p2p.telos-bad.zenblocks.io:9876" - 1 <unknown>:<unknown>] closing

Now you get:

warn  2024-09-25T21:42:48.642 net-0     net_plugin.cpp:4524           operator()           ] Unable to resolve p2p.telos-bad.zenblocks.io:9876 Host not found (authoritative)

This takes a different approach than #825. This approach is closer to Leap 4.0 approach to connection lifetime although it does keep the connections_manager added in Leap 5.0.

Plan on backporting to Leap 5.0 once this is merged.

Resolves #525

@heifner heifner added the OCI Work exclusive to OCI team label Oct 1, 2024
@heifner heifner linked an issue Oct 1, 2024 that may be closed by this pull request
plugins/net_plugin/net_plugin.cpp Outdated Show resolved Hide resolved
plugins/net_plugin/net_plugin.cpp Outdated Show resolved Hide resolved
{
std::shared_lock g( connections_mtx );
con = find_connection_i( host );
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we keep the lock until we are done using con?

Copy link
Member Author

Choose a reason for hiding this comment

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

No. get_status grabs a different mutex. Safer to not hold both.

Copy link
Contributor

Choose a reason for hiding this comment

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

So should we do the same here

Copy link
Member Author

Choose a reason for hiding this comment

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

I did do it there.

if (colon == std::string::npos || colon == 0) {
fc_elog( logger, "Invalid peer address. must be \"host:port[:<blk>|<trx>]\": ${p}", ("p", peer_address()) );
return false;
}
Copy link
Member

Choose a reason for hiding this comment

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

There seems to be a little duplication between this block and the split_host_port_type() below. I'm not sure it's worth trying to fix up though.

Copy link
Member Author

Choose a reason for hiding this comment

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

That is a bit of a mess. I'll fix it up.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

@ericpassmore ericpassmore added the bug The product is not working as was intended. label Oct 1, 2024
@heifner heifner requested a review from greg7mdp October 2, 2024 12:07
@heifner heifner merged commit eb40e5e into release/1.0 Oct 2, 2024
36 checks passed
@heifner heifner deleted the GH-525-p2p-resolve branch October 2, 2024 12:21
@ericpassmore ericpassmore removed the bug The product is not working as was intended. label Oct 2, 2024
@heifner heifner changed the title [1.0.2] P2P: Resolve on reconnect [1.0.2] P2P: Resolve on reconnect - Take 2 Oct 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCI Work exclusive to OCI team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

P2P: Resolve endpoints on re-connect attempts
4 participants