Commit Graph

321 Commits (master)

Author SHA1 Message Date
Nguyễn Gia Phong 080f8edc8e Use trio.lowlevel instead of trio.hazmat
Since trio 0.15.0, hazmat has been deprecated.

trio-typing and mypy are bumped to support newer trio and each other.
2021-02-23 22:02:34 +07:00
Alex Stokes ef666267bd
Allow `Pubsub` creator to supply a custom msg_id 2020-02-28 08:25:03 -08:00
mhchia 13e8f496a7
Noise: add noise option in the factories and tests 2020-02-28 15:50:01 +08:00
mhchia ea645f0bd6
Copied read/write from secio 2020-02-28 15:49:58 +08:00
mhchia d0290d2b5a
Noise: complete handshake process
TODO
- Figure out why `state.rs` is erased at some moment(even handshake
is not done).
- Refactor
- Add tests
2020-02-28 15:49:56 +08:00
mhchia 8a4ebd4cbb
Support read/write of noise msg and payload 2020-02-28 15:49:56 +08:00
mhchia 0324a69841
Noise: add `PatternXX` 2020-02-09 00:33:26 +08:00
mhchia 23ece34157
test_noise_connection: fix missing nursery 2020-02-07 18:17:15 +08:00
mhchia 897e66b7e1
Add the skeletons of noise transport and conn 2020-02-07 17:47:50 +08:00
mhchia ddbedc6c15
Pubsub: `handle_talk`
- Change from async function to sync
- Change the name to `notify_subscriptions`, which is clearer.
2020-02-05 21:44:33 +08:00
mhchia 7f8c0f11f6
Pubsub: change channel size
To `32` to conform to the go implementation.
2020-02-05 21:30:26 +08:00
mhchia ba0fb8a833
Fix: use `pass` over `...`(Ellipse)
Use `...`(Ellipse) only in abstract methods.
2020-02-05 20:36:42 +08:00
mhchia 1fff6ad6b4
Mplex: change message channel size to 8
To avoid infinity sized channel, and to conform to the go
implementation.
2020-02-05 20:31:18 +08:00
mhchia 1e7d5c73ee
test_mplex_stream: refactor 2020-02-05 17:25:39 +08:00
mhchia 996b5cf15d
Mplex: catch exceptions from `channel.send` 2020-02-05 17:05:30 +08:00
mhchia 0548d28568
Fix: `StreamReset` in the stream handlers
Since we don't catch `Exception` in the stream handlers, catch them in
the stream handlers in the tests.
2020-02-04 20:46:40 +08:00
mhchia 095a848f30
Add clean-up logics into TrioSubscriptionAPI
Register an `unsubscribe_fn` when initializing the TrioSubscriptionAPI.
`unsubscribe_fn` is called when subscription is unsubscribed.
2020-01-28 00:29:05 +08:00
mhchia 6e01a7da31
PR feedback: async with host.run() 2020-01-26 16:44:42 +08:00
mhchia 6c7aa30191
Add events in Pubsub
To ensure `handle_peer_queue` and `handle_dead_peer_queue` are indeed
run before the tests finish. Previously, we get errors when performing
`iter_dag` after cancellation. This is because `handle_peer_queue` or
`handle_dead_peer_queue` is not actually run before the Service is
cancelled.
2020-01-18 00:17:30 +08:00
mhchia eef241e70e
Make `Mplex` and `SwarmConn` not `Service`
After second thoughts, they seem not a good candidate of `Service`.
The shutdown logic becomes simpler by making them not `Service`.
2020-01-07 21:50:03 +08:00
mhchia 3c98b1973d
Remove useless conftest for pubsub 2019-12-26 20:43:38 +08:00
mhchia 6ae3f5dc1b
Add checkpoints in tests 2019-12-24 21:28:37 +08:00
mhchia 2287dc95be
Fix test for `info_from_p2p_addr`
It is because I removed some checks in the function. This checks should
be useless thanks to mypy
2019-12-24 18:08:33 +08:00
mhchia 3372c32432
Fix examples and modify `new_node`
- Fix examples `chat.py` and `echo.py`
    - Use trio directly, instead of `trio-asyncio`
    - Remove redundant code
- Change entry API `new_node` to `new_host_trio`
2019-12-24 18:03:18 +08:00
mhchia ce5663705f
Merge branch 'master' into feature/porting-to-trio 2019-12-24 02:19:43 +08:00
Kevin Mai-Husan Chia 1571bfac07
Merge pull request #386 from ShadowJonathan/issue_384
fixes #384
2019-12-23 14:25:38 +08:00
Jonathan de Jong 17074dded0 add tests to new multiple multiaddr change 2019-12-21 10:35:34 +01:00
NIC619 e51d376d5e
Combine `peers_gossipsub` and `peers_floodsub` 2019-12-19 14:44:49 +08:00
NIC619 f3732f9480
Fix tests 2019-12-18 12:37:04 +08:00
mhchia 47d10e186f
Add `SubscriptionAPI`
And `TrioSubscriptionAPI`, to make subscription io-agnostic.
2019-12-17 18:17:28 +08:00
mhchia fb0519129d
Refine `Mplex.close` and `SwarmConn.close`
Ensure `close` cleans up things and cancel the service finally.
2019-12-17 15:50:55 +08:00
Alex Stokes 733b1d08b6
Merge pull request #372 from ralexstokes/add-py36-compatibility
Add py36 compatibility
2019-12-10 17:28:49 -08:00
NIC Lin ad379221b9
Merge pull request #373 from NIC619/refactor_and_cleanup_gossipsub
Refactor and cleanup gossipsub
2019-12-07 16:28:55 +08:00
mhchia 837a249552
Fix `security` module 2019-12-07 00:14:01 +08:00
mhchia 1929f307fb
Fix all modules except for security 2019-12-06 17:06:37 +08:00
Chih Cheng Liang 82dcce214a
Remove kademlia module (#377)
* Remove kademlia and routing/kademlia

* cleanup

* Fix routed_host test

* lint mypy

* fix doc

* remove set_up_nodes_by_transport_and_disc_opt and fix typing
2019-12-06 14:14:33 +08:00
NIC619 db0017ddbb
Fix lint after applying suggestion 2019-12-05 17:33:07 +08:00
NIC Lin b4900d53da
Apply suggestions from code review
Co-Authored-By: Chih Cheng Liang <chihchengliang@gmail.com>
2019-12-05 15:21:09 +08:00
NIC619 fae3798ca9
Apply PR feedback: correct the comment in test 2019-12-05 14:40:49 +08:00
NIC619 8e591229fd
Update the sleep time in `test_handle_prune` 2019-12-03 23:10:56 +08:00
NIC619 bb15c817b1
Fix var access before assignment 2019-12-03 22:14:45 +08:00
NIC619 ea6cd30a16
Add back some comment and TODO. Add comment to tests 2019-12-03 18:45:33 +08:00
NIC619 60bd4694a4
Extend wait time for test to pass 2019-12-03 18:03:45 +08:00
mhchia e9ab0646e3
Fix Pubsub 2019-12-03 17:27:49 +08:00
NIC619 b405fd76e9
Add test for gossip heartbeat 2019-12-03 15:49:58 +08:00
NIC619 8dec0b111d
Add test for mesh heartbeat 2019-12-03 15:49:45 +08:00
Alex Stokes 63fd531ed0
Fixes to add python 3.6 compatibility 2019-12-02 16:33:32 -08:00
mhchia bdbb7b2394
Add `RoutedHostFactory`
And skip the tests for `RoutedHost` for now, since there are too many to
be fixed in `Kademlia`, and it's not that necessary now.
2019-12-01 19:17:44 +08:00
mhchia eb494e8682
Fix ping protocol 2019-12-01 19:17:32 +08:00
mhchia 6149aacc01
Fix `examples` 2019-12-01 17:55:07 +08:00