This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Switch from devp2p to libp2p #268
Merged
Merged
Changes from 1 commit
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
a94e7e7
Switch from devp2p to libp2p
tomaka a514ed3
Move the keys in the network state
tomaka 1cfc18e
Properly load, store or generate private key
tomaka 0e30b5d
Some robustness
tomaka 536edd6
Merge remote-tracking branch 'upstream/master' into tka-libp2p
tomaka 21ab784
Update for latest libp2p
tomaka fb17f77
Allow secio
tomaka 329b7dc
Don't open a new Kademlia connec all the time
tomaka abe756c
Handle Kademlia disconnection
tomaka 1131498
Set correct permissions on key file
tomaka d1d38d7
Improvements to secret key storage
tomaka 2277a5f
Flush the peer store at Kademlia requests
tomaka 224f6b1
Use RAII guards for disconnection
tomaka 77092a3
Some misc work
tomaka 18ee06f
Set informations about peers
tomaka 4ad5da7
Fix tests and external URL
tomaka fdc5fbf
Merge remote-tracking branch 'upstream/master' into tka-libp2p
tomaka 9e06c31
Fix some style
tomaka 5e74817
Split obtain_private_key into multiple function
tomaka 293cbdf
Split start_kademlia_discovery in multiple functions
tomaka 95c79fc
More style fixes
tomaka e8f743c
More style fixes
tomaka 61e3e57
Merge remote-tracking branch 'upstream/master' into tka-libp2p
tomaka 533f53d
Fix some concerns
tomaka fc5a342
Turn // into ///
tomaka e5390ab
More style fixes
tomaka 2316ebb
Merge remote-tracking branch 'upstream/master' into tka-libp2p
tomaka ce3b819
More style fixes
tomaka b9b54b3
Merge remote-tracking branch 'upstream/master' into tka-libp2p
tomaka dfa92bc
Merge remote-tracking branch 'origin/master' into tka-libp2p
gavofyork e9757a4
Add annotations to unreachable!
tomaka 6731f05
Fix style again
tomaka 06b5498
Remove commented out code
tomaka ab89ef9
Fix test year
tomaka 1a942a2
More concerns
tomaka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Set informations about peers
- Loading branch information
commit 18ee06f123be2aff3480c7beb4c80492d7323caa
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -377,9 +377,14 @@ fn init_thread(core: Handle, shared: Arc<Shared>, | |
| PeerIdTransport::new(base.clone(), addr_resolver) | ||
| .and_then({ | ||
|
||
| let shared = shared.clone(); | ||
| move |out, _, remote_addr| { | ||
| let info = out.info.map(move |info| { | ||
| let peer_id = info.info.public_key.clone().into_peer_id(); | ||
| move |out, endpoint, remote_addr| { | ||
| let original_addr = out.original_addr.clone(); | ||
| let info = out.info.and_then(move |info| { | ||
| let node_id = info.info.public_key.clone().into_peer_id(); | ||
| let _peer_id = shared.network_state.set_peer_info(node_id.clone(), endpoint, | ||
|
||
| info.info.agent_version.clone(), | ||
| original_addr.clone(), original_addr.clone())?; // TODO: wrong | ||
|
|
||
| // TODO: this is expensive, but eventually the multiaddr will be directly | ||
| // part of the configuration, so we don't really care | ||
| let original_listened_addr = config_to_listen_addr(&shared.config); | ||
|
|
@@ -394,11 +399,11 @@ fn init_thread(core: Handle, shared: Arc<Shared>, | |
| } | ||
| for addr in info.info.listen_addrs.iter() { | ||
| trace!(target: "sub-libp2p", "Peer store: adding address {} for {:?}", | ||
| addr, peer_id); | ||
| shared.network_state.add_kad_discovered_addr(&peer_id, addr.clone()); | ||
| addr, node_id); | ||
| shared.network_state.add_kad_discovered_addr(&node_id, addr.clone()); | ||
| } | ||
|
|
||
| info | ||
| Ok(info) | ||
| }); | ||
|
|
||
| let out = TransportOutput { | ||
|
|
@@ -571,8 +576,8 @@ where C: AsyncRead + AsyncWrite + 'a | |
| sender.send( | ||
| IdentifyInfo { | ||
| public_key: shared.network_state.local_public_key().clone(), | ||
| protocol_version: concat!("substrate/", env!("CARGO_PKG_VERSION")).to_owned(), | ||
| agent_version: "rust-libp2p/1.0.0".to_owned(), | ||
| protocol_version: concat!("substrate/", env!("CARGO_PKG_VERSION")).to_owned(), // TODO: ? | ||
| agent_version: concat!("substrate/", env!("CARGO_PKG_VERSION")).to_owned(), | ||
| listen_addrs: shared.listened_addrs.read().clone(), | ||
| protocols: Vec::new(), // TODO: protocols_to_report, | ||
| }, | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
code style for long arg lists in functions is: