Commit Graph

58 Commits

Author SHA1 Message Date
d7eab27564 refactored and moved all interfaces to abc.py (#504)
* refactored : host_interface

Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com>

* refactored : network_interface

Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com>

* refactored : notifee_interface

Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com>

* refactored : net_connection_interface

Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com>

* refactored: raw_connection_interface, secure_conn_interface and stream_muxer abc.py

* refactored: addrbook_interface

* refactored :peerdata_interface

Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com>

* refactored :peermetadata_interface

Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com>

* refactored :multiselect_client_interface

Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com>

* refactored :multiselect_communicator_interface

Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com>

* refactored :multiselect_muxer_interface

Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com>

* refactored :interfaces

Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com>

* refactored :security_transport_interface

Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com>

* refactored :listener_interface

Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com>

* moved all interfaces and typing files

Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com>

* fixed documentation and moved pubsub abc.py

Co-authored-by: Khwahish Patel <khwahish.p1@ahduni.edu.in>

* added exclude-members in custom_types docs

* added : newsfragment for moving all interfaces to libp2p.abc

---------

Co-authored-by: mystical-prog <jdgt.vd.0405@gmail.com>
Co-authored-by: Mystical <125946525+mystical-prog@users.noreply.github.com>
2025-02-21 16:01:45 -07:00
94483714a3 run lint and fix errors, except mypy 2024-02-19 16:05:58 -07:00
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
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
5b4b65faa8 Change default value of read()
From `n = -1` to `n = None`, to comply with trio API
2020-01-26 23:03:38 +08:00
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
ce5663705f Merge branch 'master' into feature/porting-to-trio 2019-12-24 02:19:43 +08:00
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
eb494e8682 Fix ping protocol 2019-12-01 19:17:32 +08:00
1e600ea7e0 Fix Mplex and Swarm 2019-11-29 19:09:56 +08:00
ec43c25b45 Rewrite factories, made some of the test running 2019-11-26 19:24:30 +08:00
417b5e7d61 remove unused asyncio 2019-11-26 15:27:06 +08:00
a397ccdc04 makes test_mplex_stream.py::test_mplex_stream_read_write work 2019-11-26 15:27:06 +08:00
41ff884eef rewrite tcp reader/writer interface 2019-11-26 15:27:05 +08:00
19907e18ec Replace (check and) del pattern with pop method 2019-11-20 23:06:37 +08:00
c0522c1bd9 Check if entry exists in dictionary before delete 2019-11-17 21:52:05 +08:00
bafdd8512d Enforce pre-summary newline in docstrings 2019-10-24 20:10:45 +02:00
3db297fbee Fix mypy errors 2019-10-24 08:53:19 +02:00
eef505f2d9 Add automatic docstring formatter and apply 2019-10-24 08:41:10 +02:00
82dc5d9e31 Ignore typing for asyncio.wait 2019-10-02 15:45:54 +08:00
a9ad37bc6f Add mplex tests and fix error in SwarmConn.close 2019-09-19 16:31:41 +08:00
5307c0506b Change IMuxedConn to INetConn in Notifee 2019-09-19 16:31:41 +08:00
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
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
df87f5adb9 Add tests against the daemon for close/reset 2019-09-10 18:01:16 +08:00
e5eb01d22b Fix stream read 2019-09-10 18:01:16 +08:00
df312f3e57 Fix linting 2019-09-10 18:01:15 +08:00
be2c0f122a Fix close behavior 2019-09-10 18:01:14 +08:00
6c1f77dc1a Fix: Change the event.close to event.set
And add missing parts.
2019-09-06 21:35:15 +08:00
649a230776 Fix MplexStream.read 2019-09-06 17:26:40 +08:00
95926b7376 Temp for mplex_stream 2019-09-06 01:08:42 +08:00
eac159c527 Restructure mplex and mplex_stream 2019-09-05 22:29:33 +08:00
96230758e4 Add events in MplexStream
And modify a little bit of `close` and `reset`
2019-09-05 18:18:39 +08:00
d35b8ffc64 Conform stream_id to go-mplex 2019-08-28 21:43:34 +08:00
a193ae81fd Fix typo w/ header tag under different reset scenarios 2019-08-26 11:39:30 -07:00
d59870ebbf Fix MplexStream error
When receiving a `NewStream`, the message of that packet is the
name of the stream, which should be handled, rather than letting it go
into the message queue.
2019-08-26 20:39:08 +08:00
c5f32bf431 PR feedback for MplexStream.read 2019-08-16 11:03:16 +08:00
8699568d43 Update libp2p/stream_muxer/mplex/mplex_stream.py
Co-Authored-By: Alex Stokes <r.alex.stokes@gmail.com>
2019-08-16 11:03:16 +08:00
b27cd0f24f Use bytearray over bytes
To avoid copies.
2019-08-16 11:03:16 +08:00
f281e3e1db flake8 2019-08-16 11:03:16 +08:00
9f8276fa84 Support read(n=-1)
Now, `n=-1` indicates that we want to read until EOF. However, now we
only read until we have no new message.
2019-08-16 11:03:16 +08:00
9cb6ec1c48 Modify the behavior of MplexStream.read 2019-08-16 11:03:16 +08:00
2485a00e24 Modify NetStream to read n bytes 2019-08-16 11:03:16 +08:00
3debd2c808 Run black and isort w/ the new config 2019-08-13 14:36:42 -07:00
cb3a59e0ac ttl as int 2019-08-05 17:02:18 +08:00
e763f57930 run isort 2019-08-05 11:47:23 +08:00
7a04ebb51f run black 2019-08-05 11:21:20 +08:00
9e0a806218 move stream and connection interfaces to abc 2019-08-05 11:17:38 +08:00
87ef2e4618 remove if TYPE_CHECKING as much as possible 2019-08-05 10:46:49 +08:00
4c9a930f84 stream_muxer done 2019-08-05 10:45:47 +08:00