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

feat(net):send message P2pDisconnectMessage before closing channel #63

Merged
merged 13 commits into from
Sep 12, 2023

Conversation

317787106
Copy link
Contributor

No description provided.

@317787106 317787106 linked an issue Aug 2, 2023 that may be closed by this pull request
@@ -29,6 +29,8 @@ public void start(P2pConfig p2pConfig) {
ChannelManager.init();
DnsManager.init();
log.info("P2p service started");

Runtime.getRuntime().addShutdownHook(new Thread(this::close));
Copy link
Contributor

Choose a reason for hiding this comment

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

It should be closed manually.
image

Copy link
Contributor Author

Choose a reason for hiding this comment

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

libp2p can be an independent process, so it uses shutdown hook. Any thread pool in libp2p will not be closed twice as it will read the condition. We may test it more completely after merging it into java-tron.

@317787106 317787106 merged commit c350328 into develop Sep 12, 2023
317787106 added a commit that referenced this pull request Oct 16, 2023
* doc(readme): update libp2p version

* feat(net):use CompletionService to get ip more quickly

* feat(log):optimize thread's name of log

* add new P2pConfig cost

* feat(net):use ScheduledThreadPoolExecutor to replace newSingleThreadExecutor

* feat(net): optimize p2p handshake logic

* optimize test case testGetIP

* optimize testcase NetUtilTest

* add message length check logic

* modify review suggestions

* hotfix(net): don't submit new task if server is closing (#56)

* hotfix(net): don't submit new task if server is closing

* feat(net):send message P2pDisconnectMessage before closing channel  (#63)

* feat(net):send message P2pDisconnectMessage before disconnect

* feat(net):optimize DisconnectReason

* feat(net): add shutdown hook

* add needToLog in Message

* feat(net): don't close P2pService twice

* delete duplicate log in HandshakeService

* don't send disconnect message if handshake fails

* update the version of grpc and protobuf

* set isdisconnect to true when closeFuture happens (#68)

* set isdisconnect=true when closeFuture happens

* add log of getip's time cost

* update version and modify test case (#69)

---------

Co-authored-by: halibobo1205 <halibobo1205@gmail.com>
Co-authored-by: halibobo1205 <82020050+halibobo1205@users.noreply.github.com>
Co-authored-by: wubin01 <wb_bupt@163.com>
Co-authored-by: chengtx01 <allen_cheng1@163.com>
Co-authored-by: allen <56535423+jwrct@users.noreply.github.com>
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.

Optimize Disconnect Logic of Libp2p
4 participants