Commit Graph

505 Commits

Author SHA1 Message Date
mhchia
95ae718e3d
Raise ParseError in read_delim 2019-09-23 16:01:22 +08:00
mhchia
92deae41dc
Change SwarmConn.conn to muxed_conn 2019-09-23 15:46:50 +08:00
mhchia
8d2415a404
Move calls to Notifee inside Swarm 2019-09-23 15:01:58 +08:00
mhchia
6f8394e4bd
Merge branch 'master' into fix/change-notifee-and-add-tests-for-swarm-conn-and-mplex 2019-09-21 18:34:12 +08:00
mhchia
539047be2d
Make mplex.read_message handle RawConnError 2019-09-21 18:17:00 +08:00
mhchia
e44c2145cc
Merge branch 'master' into fix/detection-of-close 2019-09-21 18:05:54 +08:00
mhchia
0df578d219
Add the missing exceptions.py 2019-09-21 17:18:55 +08:00
mhchia
a27a817d50
Fix tests 2019-09-20 16:17:13 +08:00
mhchia
89c127eff4
Merge branch 'master' into fix/refactor-mplex-swarm-host 2019-09-20 15:45:28 +08:00
NIC619
7fc958e7be
Add exception raised to docstring 2019-09-19 22:19:36 +08:00
NIC619
c6294ad19b
Raise MultiselectCommunicatorError:
when failed to write to communicator
2019-09-19 21:51:23 +08:00
NIC619
b9d1875027
Catch OpenConnectionError in swarm.dial_peer 2019-09-19 21:24:01 +08:00
NIC619
1f76f6ee1b
Raise OpenConnectionError
when failed to open connection
2019-09-19 21:23:35 +08:00
NIC619
c44be5e247
Add OpenConnectionError for base transport 2019-09-19 21:23:01 +08:00
mhchia
62b0bc4580
Remove useless protocol_ids in logging 2019-09-19 16:31:42 +08:00
mhchia
02c55e5d14
Add tests for MplexConn 2019-09-19 16:31:42 +08:00
mhchia
a9ad37bc6f
Add mplex tests and fix error in SwarmConn.close 2019-09-19 16:31:41 +08:00
mhchia
d61327f5f9
Add tests for SwarmConn 2019-09-19 16:31:41 +08:00
mhchia
b8b5ac5e06
Add test for notifee disconnected 2019-09-19 16:31:41 +08:00
mhchia
5307c0506b
Change IMuxedConn to INetConn in Notifee 2019-09-19 16:31:41 +08:00
mhchia
0356380996
Add tests for swarm, and debug
Fix `swarm_pair_factory`
2019-09-19 16:31:40 +08:00
mhchia
e7304538da
Add test for Swarm.close_peer 2019-09-19 16:31:12 +08:00
mhchia
6923f257f6
Remove print 2019-09-19 16:07:53 +08:00
mhchia
5f064dd329
Refactor: get rid of single huge _handle_incoming 2019-09-19 15:55:27 +08:00
mhchia
4a689c7d57
Fix error when reset
If `Mplex` is cleanup first, `MplexStream.reset` possibly fails because
`Mplex.streams` is set to `None` in `cleanup`.
2019-09-19 15:55:27 +08:00
mhchia
b51c2939a8
Handle exceptions inside read_message
And remove the need of checking `None` for every read messages.
2019-09-19 15:55:26 +08:00
mhchia
f62f07bb9f
Handle IncompleteRead in handle_incoming 2019-09-19 15:55:26 +08:00
mhchia
2d8e02b7eb
Add detection for disconnections in mplex 2019-09-19 15:55:26 +08:00
mhchia
393b51a744
isort 2019-09-19 15:53:40 +08:00
mhchia
5653b3f604
Add "closed" and "shutting_down" events 2019-09-19 15:53:39 +08:00
mhchia
7cf0495f37
Remove print 2019-09-19 15:38:38 +08:00
mhchia
a7bc9fc358
Asynchronously handling the accepted stream. 2019-09-19 13:59:51 +08:00
mhchia
6cb033fd1f
Refactor multiselect out of Swarm to BasicHost 2019-09-19 13:59:50 +08:00
mhchia
0bd213bbb7
Refactor mplex and start to add close detection 2019-09-19 13:56:05 +08:00
NIC619
f253152858
Handle protocol negotiation failure in swarm new_stream 2019-09-17 16:17:41 +08:00
NIC619
559f419b4e
Fix stream registration in accept_stream 2019-09-17 15:42:18 +08:00
NIC619
0080466d86
Handle RawConnError in InsecureSession.run_handshake 2019-09-16 19:16:41 +08:00
NIC619
09bfa0ab09
Handle IOException in create_secure_session 2019-09-16 19:15:40 +08:00
NIC619
c7593bff97
Add InconsistentNonce in secio 2019-09-16 19:11:46 +08:00
NIC619
359bcf45ff
SecioException inherit from HandshakeFailure 2019-09-16 19:11:06 +08:00
NIC619
d6dda91482
Move HandshakeFailure to libp2p.security 2019-09-16 19:09:09 +08:00
NIC619
4cd5b77f10
Raise RawConnError in RawConnection 2019-09-16 18:37:00 +08:00
NIC619
cb632fa509
Add RawConnError 2019-09-16 18:35:48 +08:00
NIC619
76af835af8
Handle MultiselectError in stream_muxer.accept_stream 2019-09-15 17:35:01 +08:00
NIC619
eaa74c4e26
Handle MultiselectCommunicatorError 2019-09-15 16:58:22 +08:00
NIC619
879f193aa1
Handle errors from
- `read_delim`
    - `read_varint_prefixed_bytes`
    - `decode_uvarint_from_stream`
2019-09-15 16:58:08 +08:00
NIC619
905a473ac3
Add MultiselectCommunicatorError 2019-09-15 16:37:37 +08:00
NIC619
68573e94d3
Have StreamError inherit from IOException 2019-09-15 16:34:16 +08:00
NIC619
f368f5e93b
Apply PR feedback 2019-09-15 15:09:58 +08:00
NIC619
501513b747
Update IMultiselectClient 2019-09-14 22:24:53 +08:00
NIC619
9bad7a61f0
Add some loggings to pubsub 2019-09-14 21:54:26 +08:00
NIC619
786a03544c
Add some loggings to swarm and cosmetic updates 2019-09-14 21:47:49 +08:00
NIC619
65a48d5c51
Remove unused select_protocol_or_fail 2019-09-14 17:42:18 +08:00
mhchia
8c8c206c33
flake8 2019-09-11 18:33:52 +08:00
mhchia
451f993058
Fix isort 2019-09-11 18:05:41 +08:00
mhchia
c1ffc0ab07
Fix transport.dial in swarm 2019-09-11 17:13:21 +08:00
Alex Stokes
cb1a25f94c
Execute the todo to remove an unused argument 2019-09-10 21:01:03 -04:00
Alex Stokes
4bd32cc4bc
Add logs during connection handshake 2019-09-10 19:02:29 -04:00
Alex Stokes
f128c746f0
Write data payload as hex to log 2019-09-10 16:17:40 -04:00
Alex Stokes
68e75707e4
Enhance logs 2019-09-10 16:04:18 -04:00
mhchia
31fb4e0b69
Rewrite _wait_for_data, to handle task precisely
Make the futures first, and then we can compare them with the return
value from `asyncio.wait`.
2019-09-10 23:38:45 +08:00
mhchia
df87f5adb9
Add tests against the daemon for close/reset 2019-09-10 18:01:16 +08:00
mhchia
e5eb01d22b
Fix stream read 2019-09-10 18:01:16 +08:00
mhchia
df312f3e57
Fix linting 2019-09-10 18:01:15 +08:00
mhchia
be2c0f122a
Fix close behavior 2019-09-10 18:01:14 +08:00
Brian Cloutier
b2146c5268
Don't crash on large messages 2019-09-09 17:13:26 -04:00
Alex Stokes
155bec0562
Fix initiator flag during secio upgrade 2019-09-09 16:40:14 -04:00
Alex Stokes
2025a5c7f1
Restore initiator flag to BaseSession type 2019-09-08 15:40:02 -04:00
Alex Stokes
50ae439d20
remove friendly IDs 2019-09-07 11:04:20 -04:00
mhchia
6c1f77dc1a
Fix: Change the event.close to event.set
And add missing parts.
2019-09-06 21:35:15 +08:00
mhchia
1cd969a2d5
Fix: Add typing in functions 2019-09-06 20:02:35 +08:00
mhchia
649a230776
Fix MplexStream.read 2019-09-06 17:26:40 +08:00
mhchia
95926b7376
Temp for mplex_stream 2019-09-06 01:08:42 +08:00
mhchia
207fa75d8f
Add reset and close 2019-09-05 23:44:22 +08:00
mhchia
10415cb956
Use ReadWriteCloser for conns and streams 2019-09-05 23:24:17 +08:00
mhchia
eac159c527
Restructure mplex and mplex_stream 2019-09-05 22:29:33 +08:00
mhchia
96230758e4
Add events in MplexStream
And modify a little bit of `close` and `reset`
2019-09-05 18:18:39 +08:00
Alex Stokes
451ec2664a
Address incorrect typing in pycryptodome dependency 2019-09-04 10:19:27 -07:00
Alex Stokes
a099b9c65d
Clean up temporary hold over from previous PR 2019-09-04 10:15:30 -07:00
Alex Stokes
b214f88f75
Avoid using message-based IO in the plaintext protocol
Can reuse the machinery in `secio` but need to generalize the
"buffering" there
2019-09-04 10:12:43 -07:00
Alex Stokes
f86ba7283d
Implement signing for RSA
- mainly for use in `secio` w/ RSA-based identities b/t peers
2019-09-04 10:12:43 -07:00
Alex Stokes
25f504ad35
Allow RSA public key type when deserializing keys 2019-09-04 10:12:43 -07:00
Alex Stokes
1a359770dd
Use msgio IO and proper buffering in secio implementation 2019-09-04 10:12:43 -07:00
Alex Stokes
fc3e3a4be5
Changes to type hints to match new abstractions 2019-09-04 10:12:43 -07:00
Alex Stokes
6d97702da7
Merge pull request #277 from ralexstokes/add-io-abstractions
Introduces IO abstractions and classes for `msgio` IO
2019-09-04 19:11:50 +02:00
Alex Stokes
a764fd4e6f
simplify some of the msgio class hierarchy via PR feedback 2019-09-04 09:57:04 -07:00
Kevin Mai-Husan Chia
e9ca372fb5
Merge pull request #271 from mhchia/fix/pubsub-interop
Pubsub interop with go-libp2p-daemon
2019-09-04 22:28:14 +08:00
mhchia
34b489af25
Fix kad_peerinfo according to peerinfo 2019-09-04 21:37:33 +08:00
mhchia
0e3d4508d6
PR feedback
- Use `Sequence` instead of `List`
- Add note
- Remove redundant words in docstring
2019-09-04 20:52:18 +08:00
Kevin Mai-Husan Chia
5113785543
Update libp2p/pubsub/pubsub.py
Co-Authored-By: NIC Lin <twedusuck@gmail.com>
2019-09-04 20:32:43 +08:00
mhchia
677531db76
Fix pubsub tests 2019-09-04 15:33:07 +08:00
Alex Stokes
2a02f92f77
Temporary porcelain until next PR 2019-09-03 21:59:50 -07:00
Alex Stokes
8e8318aa5c
Introduces IO abstractions apart from asyncio or those attached to IRawConnection
Also adds `msgio` utilities to mirror the Go implementation
2019-09-03 21:59:50 -07:00
Alex Stokes
cd3e093001
remove leftover simple security module 2019-09-03 21:38:33 -07:00
Alex Stokes
506093216c
Merge pull request #276 from ralexstokes/fix-secio-impl
Fix secio impl
2019-09-03 23:01:45 +02:00
Alex Stokes
272ab60d47
Merge pull request #275 from ralexstokes/use-different-ecc-backend
Use a different ECC backend `fastecdsa` with a compatible serializer
2019-09-03 23:00:33 +02:00
Alex Stokes
30456f8018
Use a different ECC backend with a compatible serializer
This library has the ``SEC1`` encoder which is compatible
with the serialization of ECC keys/points used in the Go libp2p impl
2019-09-03 13:44:25 -07:00
Alex Stokes
bfd674e22c
Try all pairs of choices, not just a small subset via zip 2019-09-03 13:28:31 -07:00
Alex Stokes
f8bbaf60a1
Add more information to the peer mismatch exception 2019-09-03 13:28:18 -07:00
Alex Stokes
350cc04c97
Allow the key pair to drive ID generation 2019-09-03 13:26:58 -07:00