From 8cf17a4c12fe8c6f6f49f9a2d876e307e1715994 Mon Sep 17 00:00:00 2001 From: balki <3070606-balki@users.noreply.gitlab.com> Date: Wed, 19 Dec 2018 02:04:42 -0500 Subject: [PATCH] mixx --- mail4one/pop3.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/mail4one/pop3.py b/mail4one/pop3.py index 75888c5..4c8debe 100644 --- a/mail4one/pop3.py +++ b/mail4one/pop3.py @@ -10,10 +10,11 @@ from .poputils import InvalidCommand, parse_command, err, Command, ClientQuit, C Request, MailEntry, get_mail, get_mails_list, MailList +# noinspection PyProtectedMember @dataclass class Session: - reader: asyncio.StreamReader - writer: asyncio.StreamWriter + _reader: asyncio.StreamReader + _writer: asyncio.StreamWriter # common state all_sessions: ClassVar[Set] = set() @@ -26,11 +27,11 @@ class Session: @classmethod def reader(cls): - return cls.get().reader + return cls.get()._reader @classmethod def writer(cls): - return cls.get().writer + return cls.get()._writer async def next_req(): @@ -61,13 +62,11 @@ async def expect_cmd(*commands: Command): def write(data): logging.debug(f"Server: {data}") - session: Session = Session.current_session.get() - session.writer.write(data) + Session.writer().write(data) async def drain(): - session: Session = Session.current_session.get() - await session.writer.drain() + await Session.writer().drain() def validate_user_and_pass(username, password):