-
Notifications
You must be signed in to change notification settings - Fork 18
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
Conversation
@@ -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)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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.
src/main/java/org/tron/p2p/connection/business/handshake/HandshakeService.java
Show resolved
Hide resolved
src/main/java/org/tron/p2p/connection/business/handshake/HandshakeService.java
Outdated
Show resolved
Hide resolved
src/main/java/org/tron/p2p/connection/business/handshake/HandshakeService.java
Outdated
Show resolved
Hide resolved
* 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>
No description provided.