mirror of
https://github.com/varun-r-mallya/py-libp2p.git
synced 2026-02-09 14:40:53 +00:00
BaseMsgReadWriter
- Change `BaseMsgReadWriter` to encode/decode messages with abstract method, which can be implemented by the subclasses. This allows us to create subclasses `FixedSizeLenMsgReadWriter` and `VarIntLenMsgReadWriter`.
This commit is contained in:
@ -3,7 +3,7 @@ from libp2p.crypto.keys import PrivateKey, PublicKey
|
||||
from libp2p.crypto.pb import crypto_pb2
|
||||
from libp2p.crypto.serialization import deserialize_public_key
|
||||
from libp2p.io.abc import ReadWriteCloser
|
||||
from libp2p.io.msgio import BaseMsgReadWriter
|
||||
from libp2p.io.msgio import FixedSizeLenMsgReadWriter
|
||||
from libp2p.network.connection.exceptions import RawConnError
|
||||
from libp2p.network.connection.raw_connection_interface import IRawConnection
|
||||
from libp2p.peer.id import ID
|
||||
@ -23,7 +23,7 @@ PLAINTEXT_PROTOCOL_ID = TProtocol("/plaintext/2.0.0")
|
||||
SIZE_PLAINTEXT_LEN_BYTES = 4
|
||||
|
||||
|
||||
class PlaintextHandshakeReadWriter(BaseMsgReadWriter):
|
||||
class PlaintextHandshakeReadWriter(FixedSizeLenMsgReadWriter):
|
||||
size_len_bytes = SIZE_PLAINTEXT_LEN_BYTES
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user