Moved dummyconnection back out of common/__init__.py

This commit is contained in:
Michael Woods
2025-02-15 15:20:34 -05:00
parent ed02b86e79
commit 1c64a6df6c
2 changed files with 20 additions and 15 deletions

View File

@@ -82,21 +82,6 @@ class PacketServerConnection(Connection):
def query_accept(cls, port, call_from, call_to): def query_accept(cls, port, call_from, call_to):
return True return True
class DummyPacketServerConnection(PacketServerConnection):
def __init__(self, call_from: str, call_to: str, incoming=False):
super().__init__(0, call_from, call_to, incoming=incoming)
self.sent_data = Unpacker()
self._state = ConnectionState.CONNECTED
@property
def state(self):
return self._state
def send_data(self, data: Union[bytes, bytearray]):
self.sent_data.feed(data)
logging.debug(f"Sender added {data} to self.sent_data.feed")
class Message: class Message:
"""Base class for communication encapsulated in msgpack objects.""" """Base class for communication encapsulated in msgpack objects."""

View File

@@ -0,0 +1,20 @@
from . import PacketServerConnection
from pe.connect import ConnectionState
from msgpack import Unpacker
from typing import Union, Self
import logging
class DummyPacketServerConnection(PacketServerConnection):
def __init__(self, call_from: str, call_to: str, incoming=False):
super().__init__(0, call_from, call_to, incoming=incoming)
self.sent_data = Unpacker()
self._state = ConnectionState.CONNECTED
@property
def state(self):
return self._state
def send_data(self, data: Union[bytes, bytearray]):
self.sent_data.feed(data)
logging.debug(f"Sender added {data} to self.sent_data.feed")