diff --git a/app/c_connection.py b/app/c_connection.py new file mode 100644 index 0000000..56b675d --- /dev/null +++ b/app/c_connection.py @@ -0,0 +1,16 @@ +from app.utility.base_object import BaseObject + + +class Connection(BaseObject): + + def __init__(self, reader, writer): + super().__init__() + self.reader = reader + self.writer = writer + + async def recv(self, num_bytes): + return await self.reader.read(num_bytes) + + async def send(self, data): + self.writer.write(data) + await self.writer.drain() diff --git a/app/c_session.py b/app/c_session.py index ded4c28..03ed273 100644 --- a/app/c_session.py +++ b/app/c_session.py @@ -1,4 +1,5 @@ from app.utility.base_object import BaseObject +from plugins.manx.app.c_connection import Connection class Session(BaseObject): @@ -7,7 +8,7 @@ class Session(BaseObject): def unique(self): return self.hash('%s' % self.paw) - def __init__(self, id, paw, connection): + def __init__(self, id, paw, connection: Connection): super().__init__() self.id = id self.paw = paw