Commit Graph

445 Commits

Author SHA1 Message Date
ca9534a38e Add a user data to CollectionStream (#947)
* Add a user data to CollectionStream

* Make NodeEvent return a PeerMut

* Add PeerMut::user_data_mut()

* Return the previous user data in accept()
2019-02-18 16:10:00 +01:00
2d31c2f733 Minor opti poll Fuse (#946) 2019-02-18 11:24:01 +01:00
965c154093 Accept empty substreams in read_one (#943) 2019-02-18 10:58:12 +01:00
1100325e63 Improve nodes state (#917)
* Improve the state consistency in src/nodes

* Add a user data parameter to tasks

* Remove the tasks HashMap in CollectionStream

* Add TODO
2019-02-14 13:46:52 +01:00
f112f198b6 Add Ord implementation for KeepAlive (#918)
* Add Ord implementation for KeepAlive

* Fix import path

* Implement PartialOrd for KeepAlive

* remove Ord implementation

* Reimplement Ord for KeepAlive

* Add equality cases to KeepAlive Ord implementation
2019-02-14 11:35:24 +01:00
3548c29dcf Improvements to the helpers in upgrade::transfer (#937)
* Improvements to the helpers in upgrade::transfer

* Fix floodsub
2019-02-14 11:00:46 +01:00
e377a58b49 Fix compiling for WASM with websockets disabled (#934)
* Fix compiling for WASM with websockets disabled

* Comment about usage
2019-02-11 17:45:22 +01:00
eeed66707b Address edition-2018 idioms. (#929) 2019-02-11 14:58:15 +01:00
21810e46bd Fix infinite loop in read_one (#910)
* Fix infinite loop in read_one

* Also fix request_respond
2019-02-11 14:02:29 +01:00
63db253566 Fix duplicate external addresses inserted (#927) 2019-02-07 13:46:39 +01:00
909f50f989 Swarm::dial adds addresses when pending (#919)
* Swarm::dial adds addresses when pending

* Bump libp2p-core to 0.3.3
2019-02-05 17:29:30 +01:00
479924f8dc Bump libp2p, libp2p-core, libp2p-core-derive and libp2p-kad (#916)
* Bump libp2p-core, libp2p-core-derive and libp2p-kad

* Bump libp2p as well
2019-02-04 15:46:08 +01:00
c9b7e237b6 Add NetworkBehaviour::inject_replaced (#914)
* Add NetworkBehaviour::inject_replaced

* Address style

* Forgot to call set_disconnected

* Also add incoming addresses to kbuckets
2019-02-04 15:21:50 +01:00
7f66c4f4b0 Add Swarm::add_external_address (#915) 2019-02-04 14:33:05 +01:00
f999fd506a Fix the dialing priority system (#907)
* Fix the dialing priority system

* Bump libp2p-core to 0.3.1

* Cancel dialing attempt if we don't have priority

* Add test for simultaneous dialing

* Improve test

* Fix test stuck forever
2019-02-01 15:21:20 +01:00
fcb2ac36e6 Bump to v0.3.0 (#905) 2019-01-30 16:50:47 +01:00
663ec7e8da connection_keep_alive() now returns KeepAlive (#899)
* connection_keep_alive() now returns Option<Instant>

* Use KeepAlive instead of Option<Instant>
2019-01-30 16:37:34 +01:00
bbf56c6371 Update protobuf to version 2.3.0 (#904)
Initially I had hoped that the deprecated `#![allow(clippy)]` would no
longer be put into the generated rust files, but -- as of 2019-01-30 --
it still is (see [1] for details). Since we explicitly update the
protobuf files I decided to *manually edit the generated code* and
replace this with `#![allow(clippy:all)]`. Hopefully, by the time we do
the next upgrade, no such manual tweaking would be necessary anymore. I
think the benefit of a less polluted clippy output is worth it this
time.

[1]: https://github.com/stepancheg/rust-protobuf/pull/332
2019-01-30 16:25:45 +01:00
e23b2733e2 Fix some rustc/clippy warnings. (#895) 2019-01-30 15:41:54 +01:00
a77da73010 Add inject_dial_failure and make addresses_of_peer mut (#901)
* Add inject_dial_failure and make addresses_of_peer mut

* Fix tests
2019-01-30 14:55:39 +01:00
35ec7f053c Proper shutdown in ProtocolsHandlerSelect (#870)
* Proper shutdown in ProtocolsHandlerSelect

* Fix infinite loop
2019-01-29 19:52:22 +01:00
b8dfa724fd Add some helpers for substream upgrades (#896)
* Add some helpers for substream upgrades

* Fix compilation

* Fix compilation for 32bits

* Fix some concerns

* Add read_one_then

* Fixes
2019-01-29 16:20:14 +01:00
fe4fc8c363 Move final crates to 2018 edition (#886) 2019-01-29 11:02:29 +01:00
df923526ca Embed the topology in the NetworkBehaviour (#889)
* Embed the topology in the NetworkBehaviour

* Put topologies inside of Floodsub and Kad

* Fix core tests

* Fix chat example

* More work

* Some cleanup

* Restore external addresses system
2019-01-26 23:57:53 +01:00
30c082dfe5 Properly shut down protocols handler on useless timeout (#892) 2019-01-25 15:56:32 +01:00
d9b30c6c6a Make nodes generic over PeerId (#881) 2019-01-23 17:44:40 +01:00
a2ab7ff4a9 Simplify the floodsub handler (#868) 2019-01-22 14:45:03 +01:00
d59ec09a83 Add a maximum limit to the number of listeners (#809)
* add max_listeners to swarm

* add swarm builder

* swarm_builder's build takes ownership of self

* replace max listeners with incoming limit

* don't disconnect from node after incoming limit has been reached

* update code according to recent changes

* don't poll listeners at all if incoming connection limit is reached
2019-01-22 11:59:59 +01:00
ad27a468f8 Deny connection with local PeerId (#859) 2019-01-17 12:20:02 +01:00
21d219ef45 Bump to v0.2.1 (#851) 2019-01-14 14:58:07 +01:00
bf52e9bd19 Add IntoNodeHandler and IntoProtocolsHandler traits (#848)
* Add IntoNodeHandler

* Add IntoProtocolsHandler
2019-01-14 14:22:25 +01:00
e39d6d8bd2 Version 0.2 (#841) 2019-01-10 13:27:45 +01:00
b8a312f7d5 Forbid dialing self (#839) 2019-01-10 11:49:36 +01:00
dbff125df2 Add an Error associated type to transports (#835)
* Add an Error associated type to transports

* Improve raw swarm a bit

* Rename map_other to map

* Use source() instead of cause()

* RawSwarmIncErr -> IncomingError
2019-01-10 11:27:06 +01:00
1e7fcc6d61 Move tests to separate files (#827) 2019-01-09 15:48:56 +01:00
f1959252b7 multistream-select: Less allocations. (#800) 2019-01-09 15:09:35 +01:00
aedf9c0c31 Add more methods on Topology (#826)
* Add more methods on Topology

* Add a DisconnectReason
2019-01-09 13:13:21 +01:00
64b388ddd1 Add RawSwarm::incoming_negotiated (#821)
* Add RawSwarm::incoming_negotiated

* More tweaks

* Docfix
2019-01-07 11:54:42 +01:00
5742a0000e Add documentation to the core (#820) 2019-01-07 11:39:08 +01:00
2eb7fe7c64 Switch libp2p-core to edition 2018 (#819) 2019-01-07 11:21:09 +01:00
7da1a860be Automatically close useless connections (#816)
* Automatically close useless connections

* Add a timeout before dropping the connection

* Rework the timeout

* Use OR to combine the outcome
2019-01-04 12:02:39 +01:00
2c2fc8bfd3 Don't allow handlers::poll() to return None (#811) 2019-01-02 14:22:23 +01:00
f903e2b744 Add version numbers of multi* deps (#810) 2019-01-02 13:45:23 +01:00
7798e23e78 Add an error associated type to ProtocolsHandler (#795) 2018-12-28 15:11:35 +01:00
d10cafa804 Make deriving the NetworkBehaviour more ergonomic (#782) 2018-12-20 15:21:13 +01:00
6be3aca768 Cleanup. (#803)
- Use `Error::source` instead of `Error::cause`.
- Remove unused import.
2018-12-20 13:41:11 +01:00
83320e0347 More precise error passed to inject_dial_upgrade_error (#771)
* More precise error passed to inject_dial_upgrade_error

* Fix concerns

* Fix panic proof
2018-12-18 11:23:13 +01:00
40a503fd63 Store information about the local node in the topology (#772)
* Store information about the local node in the topology

* Fix build

* Store the external addresses in the topology
2018-12-13 19:06:13 +01:00
69684a97b2 More precise errors in the nodes module (#765)
* More precise errors in the nodes module

* Typo

* Prove the panics
2018-12-11 15:36:41 +01:00
a152e18821 Simplify handling of upgrade information. (#761) 2018-12-11 15:13:10 +01:00