mhchia
3c2e835725
Security: SecureSession
...
Make security sessions(secio, noise) share the same implementation
`BaseSession` to avoid duplicate implementation of buffered read.
2020-02-28 15:49:59 +08:00
mhchia
2df47a943c
Refactor
2020-02-28 15:49:59 +08:00
mhchia
874c6bbca4
Refactor MsgIOReadWriter
...
- Abstract it as `MsgReadWriter`
- `MsgIOReadWriter` as a subclass of `MsgReadWriter`
2020-02-28 15:49:58 +08:00
mhchia
ea645f0bd6
Copied read/write from secio
2020-02-28 15:49:58 +08:00
mhchia
f8739268e2
Noise: encrypt and decrypt in NoiseConnection
...
TODO: Add a buffer to read only `n` bytes in `read(n)`
2020-02-28 15:49:58 +08:00
mhchia
6ea96e9313
Add comments in pattern xx
2020-02-28 15:49:57 +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
Kevin Mai-Husan Chia
1f881e0464
Merge pull request #405 from mhchia/feature/noise
...
Noise: skeleton of transport and connection
2020-02-28 15:44:49 +08:00
mhchia
4620544d45
Noise: fix docs
2020-02-15 12:35:36 +08:00
mhchia
f4c545ed68
isort: add noise
to 3rd party config
2020-02-15 12:18:44 +08:00
mhchia
95959725db
Noise pattern: Fix flake8
2020-02-15 12:18:19 +08:00
mhchia
d7fabab3e1
Noise: add compiled pb2.py
2020-02-09 13:23:12 +08:00
mhchia
0324a69841
Noise: add PatternXX
2020-02-09 00:33:26 +08:00
mhchia
f27db83a14
Noise: add TODO comments
2020-02-08 10:48:29 +08:00
mhchia
fb53edbc04
Change async def write
...
To return `None` instead of `int. `Writer.write` *does* write all data
in all use case.
2020-02-08 10:24:37 +08:00
Kevin Mai-Husan Chia
1152f9b703
Update libp2p/security/noise/transport.py
...
Co-Authored-By: Alex Stokes <r.alex.stokes@gmail.com>
2020-02-08 10:14:35 +08:00
mhchia
23ece34157
test_noise_connection: fix missing nursery
2020-02-07 18:17:15 +08:00
Kevin Mai-Husan Chia
99f505d6d7
Merge pull request #403 from hukkinj1/disable-incremental-mypy
...
Disable incremental mode of mypy
2020-02-07 18:10:34 +08:00
mhchia
897e66b7e1
Add the skeletons of noise transport and conn
2020-02-07 17:47:50 +08:00
Taneli Hukkinen
2f3c5b2ee0
Disable incremental mode of mypy
2020-02-06 13:21:36 +01:00
Kevin Mai-Husan Chia
e63584c387
Merge pull request #404 from libp2p/feature/trio
...
Merge `feature/trio` into `master`
2020-02-06 10:49:53 +08:00
mhchia
f1dbd52d67
Merge branch 'master' into feature/trio
2020-02-06 10:39:54 +08:00
Kevin Mai-Husan Chia
7c74e36d41
Merge pull request #365 from mhchia/feature/porting-to-trio
...
Porting to trio
2020-02-06 10:14:11 +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
5b03a7ad9f
Mplex: only close the send of new stream channel
2020-02-05 21:41:28 +08:00
mhchia
b7c2ec2187
Mplex: change the reference url
...
To the commit hash, to make it more correct.
2020-02-05 21:31:04 +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
64c9c48dac
Mplex: change new stream channel size
...
To `0`, i.e. no unbuffered, to avoid growing buffer size.
2020-02-05 19:48:02 +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
12cb0d9ac4
Swarm: change notify_xxx
back to async func
2020-02-04 22:56:13 +08:00
mhchia
13930ae718
SwarmConn: perform close
right away
...
In `_handle_new_streams`, when the underlying muxed conn is unavailable,
close `SwarmConn` itself right away, to reset all the streams.
Therefore, the stream processed by `_handle_muxed_stream` are conscious
of the fact that they are reset. It allows a more graceful clean up.
2020-02-04 22:51:21 +08:00
mhchia
c0ab609559
Mplex: catch RawConnError
when writing
...
Also, do nothing in `MplexStream.reset` if `MuxedConnUnavailable` is
raised when sending the message.
2020-02-04 21:57:59 +08:00
mhchia
f884bfa39e
SwarmConn: don't access Swarm.manager
...
Open a local nursery instead.
2020-02-04 21:57:11 +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
a7ba59bf9f
Add a nursery in Swarm
...
To avoid using the one in `Service`
2020-02-04 20:45:58 +08:00
mhchia
b007bb4d07
Use the latest async-service
2020-02-04 17:46:30 +08:00
mhchia
89338914d3
Add comment for serve_tcp
2020-02-04 17:45:56 +08:00
mhchia
857bb34f4e
Add checkpoints in PubsubNotifee
...
Since some of the methods in `PubsubNotifee` are doing nothing,
add checkpoints to yield control.
2020-02-04 17:45:37 +08:00
mhchia
66975ae3f2
Pubsub: change run_task
to run_daemon_task
2020-02-04 17:43:39 +08:00
mhchia
7ae9de9002
Fix handler in net_stream_pair_factory
...
Change it to async function. It wasn't discovered since we caught all
exceptions raised in stream handlers.
2020-02-04 17:09:26 +08:00
mhchia
3a91f114ab
Swarm: add default_stream_handler
...
Advantage:
- To avoid `None` checks
- If users forget to register a stream handler for `Swarm`,
with the default stream handler, opened streams aren't removed
until `Swarm` finishes.
2020-02-04 17:05:53 +08:00
mhchia
3fc60cb312
SwarmConn: iterate streams.copy
in _cleanup
...
To avoid `RuntimeError` if `streams` is changed.
2020-02-04 17:04:28 +08:00
mhchia
d483982acb
SwarmConn: don't catch exceptions in handler
2020-02-04 15:10:49 +08:00
mhchia
5da102d1c9
Ping protocol: move with
statement out of try
2020-02-04 15:09:42 +08:00
mhchia
113696dce2
TravisCI: use python 3.7
instead of 3.7-dev
2020-02-03 16:04:32 +08:00
mhchia
22963a3099
Fix trio-typing>=0.3,<0.4
...
To be consistent with trinity
2020-02-02 18:18:01 +08:00