From ed13036588e44f77f5151169d95062d9224c7890 Mon Sep 17 00:00:00 2001 From: s723138643 Date: Sat, 29 Apr 2017 10:22:38 +0800 Subject: [PATCH] if there is no data to send, we should unregister WRITE event --- magneticod/magneticod/__main__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/magneticod/magneticod/__main__.py b/magneticod/magneticod/__main__.py index 70d7cc7..32bd4ba 100644 --- a/magneticod/magneticod/__main__.py +++ b/magneticod/magneticod/__main__.py @@ -167,6 +167,8 @@ def loop() -> None: fileobj = keymap[fd].fileobj if fileobj.would_send(): selector.modify(fileobj, selectors.EVENT_READ | selectors.EVENT_WRITE) + else: + selector.modify(fileobj, selectors.EVENT_READ) def parse_cmdline_arguments() -> typing.Optional[argparse.Namespace]: