diff --git a/libp2p/protocol_muxer/multiselect_client.py b/libp2p/protocol_muxer/multiselect_client.py index 902b022..44b217f 100644 --- a/libp2p/protocol_muxer/multiselect_client.py +++ b/libp2p/protocol_muxer/multiselect_client.py @@ -16,28 +16,6 @@ class MultiselectClient(IMultiselectClient): module in order to select a protocol id to communicate over """ - async def _handshake(self, communicator: IMultiselectCommunicator) -> None: - """ - Ensure that the client and multiselect - are both using the same multiselect protocol - :param stream: stream to communicate with multiselect over - :raise Exception: multiselect protocol ID mismatch - """ - - # TODO: Use format used by go repo for messages - - # Send our MULTISELECT_PROTOCOL_ID to counterparty - await communicator.write(MULTISELECT_PROTOCOL_ID) - - # Read in the protocol ID from other party - handshake_contents = await communicator.read() - - # Confirm that the protocols are the same - if not validate_handshake(handshake_contents): - raise MultiselectClientError("multiselect protocol ID mismatch") - - # Handshake succeeded if this point is reached - async def select_protocol_or_fail( self, protocol: TProtocol, communicator: IMultiselectCommunicator ) -> TProtocol: @@ -110,31 +88,6 @@ class MultiselectClient(IMultiselectClient): # No protocols were found, so return no protocols supported error raise MultiselectClientError("protocols not supported") - async def _try_select( - self, communicator: IMultiselectCommunicator, protocol: TProtocol - ) -> TProtocol: - """ - Try to select the given protocol or raise exception if fails - :param communicator: communicator to use to communicate with counterparty - :param protocol: protocol to select - :raise Exception: error in protocol selection - :return: selected protocol - """ - - # Tell counterparty we want to use protocol - await communicator.write(protocol) - - # Get what counterparty says in response - response = await communicator.read() - - # Return protocol if response is equal to protocol or raise error - if response == protocol: - return protocol - if response == PROTOCOL_NOT_FOUND_MSG: - raise MultiselectClientError("protocol not supported") - raise MultiselectClientError("unrecognized response: " + response) - - def validate_handshake(handshake_contents: str) -> bool: """ Determine if handshake is valid and should be confirmed