158 Commits

Author SHA1 Message Date
Pierre Krieger
3e53a9dcc7
Fix additional addresses not tried (#483)
* Fix additional addresses not tried

* More fixes

* Produce a dialing error if unsupported multiaddr
2018-09-17 10:30:10 +02:00
Pierre Krieger
2a7a48b496
Fix old task not interrupted after replacing (#482) 2018-09-14 20:40:28 +02:00
Pierre Krieger
063ab178a9
Add an alternative to the swarm (#472)
* Rewrite the swarm

* Small improvement to Debug of ListenersStream

* Fix Swarm::Replaced never being produced

* Fix logic problem when reaching a node in swarm

* Small comment in swarm

* Add closed_multiaddr to Replaced event

* Add address to NodeClosed and NodeError

* Fix concerns

* Remove StreamMuxer::boxed
2018-09-14 13:18:10 +02:00
Pierre Krieger
fd4b7488be
Add some comments about the notification behaviour of muxers (#453) 2018-09-11 11:17:44 +02:00
Pierre Krieger
381c071cbc
Add BoxedMuxed transport (#459)
* Add BoxedMuxed transport

* Extend to both muxed and non-muxed versions

* Style

* Implement Debug for boxed transports
2018-09-06 16:59:47 +02:00
Toralf Wittner
5c35047ee3 Change stream ID handling to consider flags. (#436)
Replaces the former odd/even distinction of IDs. However we still increment stream IDs by 2
for backwards compatibility.
2018-09-06 13:59:14 +02:00
Pierre Krieger
ea1f172397
Implement Send everywhere (#458) 2018-09-06 09:54:35 +02:00
Pierre Krieger
bca1083d9c
Make the Futures in map_err Send-friendly (#418)
* Make the Futures in map_err Send-friendly

* Address concern
2018-09-05 09:09:32 +02:00
Pierre Krieger
75ceba7809
The SwarmFuture is now a Stream (#442)
* The SwarmFuture is now a Stream

* Return the produced future in the message

* Remove IncomingConnection event

* Pass error when failing to dial

* Fix loop break mistake

* Fix concern

* Rename SwarmFuture to SwarmEvents

* Increase type length limit

* Remove todo
2018-09-04 14:53:27 +02:00
Guanqun Lu
ee9be6f0c9 add must_use for Future (#450) 2018-09-04 12:30:57 +02:00
Pierre Krieger
f787c80a42 Merge the changes from polkadot-2 into master (#446) 2018-09-03 16:46:15 +02:00
Pierre Krieger
0e1483f02e Rework the StreamMuxer trait (#437)
* Stronger typing for the swarm handler future
* The swarm future is now a swarm stream of events
* Rewrite StreamMuxer in core
* Update libp2p_mplex for the new stream muxer
* Update yamux for new stream muxer
2018-08-31 10:31:34 +02:00
Toralf Wittner
c02dea8128
Introduce several concrete future types. (#433)
* multisteam-select: introduce `DialerFuture`.

* multistream-select: add more concrete futures.

* multistream-select: add ListenerFuture.

* multistream-select: add ListenerSelectFuture

* Formatting.

* Add DialerSelectFuture type alias.

* Add UpgradeApplyFuture and NegotiationFuture.

* In iterator wrappers also pass-through size_hint.

* Minor refactoring.

* Address review comments.

* Add some comments.

* Hide state enums in wrapping structs.
2018-08-30 23:25:16 +02:00
Benjamin Kampmann
2ea49718f3
Clean up directory structure (#426)
* Remove unused circular-buffer crate
* Move transports into subdirectory
* Move misc into subdirectory
* Move stores into subdirectory
* Move multiplexers
* Move protocols
* Move libp2p top layer
* Fix Test: skip doctest if secio isn't enabled
2018-08-29 11:24:44 +02:00
Pierre Krieger
c77b1f5a0a Better documentation (#391)
* Better documentation

* Minor
2018-08-22 10:46:23 +02:00
Pierre Krieger
c6e28dcc45 Add Transport::map_err_dial (#392) 2018-08-15 17:42:34 +02:00
Pierre Krieger
bd73f60358 Add some Send implementations to Futures (#412) 2018-08-14 15:23:30 +02:00
Pierre Krieger
d94fe1b831 Use a Multihash in AddrComponent::P2P, drop cid (#407)
* Use a Multihash in AddrComponent::P2P
* Remove the cid crate from the repo
2018-08-10 17:47:02 +02:00
Pierre Krieger
d4b98e8646 Add upgrade::loop_upg (#394) 2018-08-10 16:55:47 +02:00
Pierre Krieger
078fa1cb33
Rework the multihash crate (#403)
* Use Multihash and MultihashRef instead

* Don't use star imports

* Split EncodeError and DecodeError

* Add DecodeOwnedError

* Some cleanup

* Remove Hash::name()

* Some crate root documentation

* Add some more methods

* Fix tests

* Add PartialEq between Multihash and MultihashRef

* Fix the rest of the repo

* Rename hash_data() to digest()

* Add comment about varint

* Remove Error::description impls
2018-08-09 14:51:09 +02:00
Pierre Krieger
ea881e3dfa Rework swarm and allow interrupting a dial (#366)
* Rework swarm and allow interrupting a dial
* Improve the UniqueConnec situation
* Remove UniqueConnec::get
* Rename `get_or_dial()` to `dial()` and add `dial_if_empty()`
* Clean the UniqueConnec is the future is dropped
* Rename `set_until` to `tie_or_stop` and add `tie_or_passthrough`
* Add some tests, docs
* Fix memory leak with tasks registration
* Interrupt dialing when a UniqueConnec is dropped or cleared
2018-08-08 12:00:38 +02:00
Pierre Krieger
0348ac3534 Make ping unidirectional (#381) 2018-08-06 17:16:27 +02:00
Pierre Krieger
1110907d78 Rewrite multiplex tests to use the memory transport (#370) 2018-08-06 10:41:11 +02:00
Pierre Krieger
c677980f91 Add Transport::map_err (#317)
* Add Transport::map_err
2018-07-31 10:43:41 +02:00
Pierre Krieger
ffe63ff987 Unify the versions of parking_lot (#380) 2018-07-30 16:06:03 +02:00
James Ray
3d6b1dbc3e Put comments in code and ie. -> i.e. (#375) 2018-07-27 10:10:14 +02:00
Toralf Wittner
81e8735968 Add memory transport. (#343)
* Add memory transport.

* Change test to be compatible with rust stable.

* Address concerns

* Add some documentation and minor fixes

* Move transport test to memory module
2018-07-25 13:44:27 +02:00
Pierre Krieger
9480295bf2
Add licenses to all Cargo.toml files (#349) 2018-07-21 12:15:42 +02:00
Pierre Krieger
6acc0c7c5f
Add UniqueConnec::is_alive (#339) 2018-07-19 14:00:13 +02:00
Pierre Krieger
0cfaa23908
Add upgrade::map_with_addr (#331)
* Add upgrade::map_with_addr

* Some help for inferrence
2018-07-19 10:55:04 +02:00
Pierre Krieger
294310cd07
Rewrite multiplex (#261)
* Rewrite multiplex

* Increase the packet size limit to 32 MB

* Fix waiting for poll_complete to finish

* Typo

* Properly close substreams

* Add a limit to the number of substreams

* Add a limit to the length of the internal buffer

* Fix concerns
2018-07-17 16:31:32 +02:00
Pierre Krieger
053197bd1c
Rework the Kademlia high-level system (#282)
* Kademlia high-level rework

* Some changes in the rework

* Some additional tweaks to kad rework

* Add update_kbuckets

* Rename a bunch of Kademlia stuff

* Add KadSystem::local_peer_id

* Some documentation update

* Concern

* Make the example compile

* Make things nicer

* Fix bug in UniqueConnec

* Add clear() to UniqueConnec

* Add UniqueConnec::poll

* Fix potential deadlock in UniqueConnec

* Add UniqueConnec::state()

* The future of get now contains a Weak

* Fix concerns
2018-07-17 15:51:11 +02:00
Pierre Krieger
bd965d1668
Test creating lots of connections amongst lots of swarm (#304)
* Use the new version of tokio

* Add tests for lots of connections in a swarm

* Remove wrongly-added file
2018-07-16 16:56:05 +02:00
Pierre Krieger
16e3453b7f
Use the new version of tokio (#303) 2018-07-16 12:15:27 +02:00
Pierre Krieger
e74e3f4950
Remove the AsyncRead/Write bounds in ConnectionUpgrade (#302) 2018-07-14 14:12:19 +02:00
Pierre Krieger
4592d1b21e
SwarmController::dial now returns a Future (#290)
* SwarmController::dial now returns a Future

* Minor comment
2018-07-14 13:46:11 +02:00
Pierre Krieger
c05e7e0c4e
Two minor swarm tests (#300) 2018-07-14 13:31:22 +02:00
Qian LinFeng
fd01b18e53 Upgrade and unify protobuf version(1.x => 2.0.2) (#283)
* Update and unify protobuf version(1.x => 2.0.2)

* Update protobuf codegen shell script
2018-07-10 14:07:28 +02:00
Pierre Krieger
03947908b4
Add upgrade::toggleable (#281)
* Add upgrade::toggleable

* Some minor fixes/improvements
2018-07-03 16:10:15 +02:00
Pierre Krieger
a7a06aa5ab
Fix wrong endpoint in and_then (#278) 2018-06-28 10:24:24 +02:00
Pierre Krieger
143a1845b1
The PeerId is the hash of the protobuf encoding (#276) 2018-06-25 17:56:36 +02:00
Pierre Krieger
795961b15e
Fix the public key format in the IdentifyInfo (#264)
* Fix the public key format in the IdentifyInfo

* Move PublicKey type to core

* Oops
2018-06-25 14:54:55 +02:00
Pierre Krieger
de39e321e9
Fix a missing loop in SwarmFuture::poll (#272) 2018-06-25 14:29:15 +02:00
Pierre Krieger
ab96f7efe0
Add loops around stream polling (#251) 2018-06-22 11:02:47 +02:00
Pierre Krieger
7b375798a5
The Multiaddr of the remote is now a Future (#249)
* The Multiaddr of the remote is now a Future

* The multiaddress future in swarm is now a Box
2018-06-19 14:38:55 +02:00
Pierre Krieger
28fdf23d67
Add some regression tests in libp2p-core (#237) 2018-06-05 19:01:18 +02:00
Pierre Krieger
dbbee5756e
Use stronger typing for the public key of identify (#236)
* Use stronger typing for the public key of identify

* Add PartialEq/Eq implementations

* Fix tests

* Also change is_public_key()
2018-06-05 12:29:59 +02:00
Pierre Krieger
be2fa0e531
Turn warn! into debug! (#235) 2018-06-04 15:53:58 +02:00
Pierre Krieger
57c3103f78
Integrate the multiformats crates (#231)
* Remove the multihash patch

* Integrate the multiformats crates

* Fix not compiling on emscripten
2018-06-01 10:10:00 +02:00
Pierre Krieger
c1cd10c034
upgrade::or() requires same Output (#218) 2018-05-24 16:37:12 +02:00