Skip to content
Browse files

Override asyncore.dispatcher.writable()

Override asyncore.dispatcher.writable() to return False,
so that asyncore.loop() doesn't consume all available CPU
when plugins are instantiated.
  • Loading branch information...
1 parent d2b9028 commit 3c1009a4d020390c365fa805fdf21a8a32537c21 @mmcgill mmcgill committed
Showing with 6 additions and 0 deletions.
  1. +6 −0 mc3p/plugins.py
View
6 mc3p/plugins.py
@@ -87,6 +87,9 @@ def handle_read(self):
except PartialPacketException:
pass # Not enough data in the buffer
+ def writable(self):
+ return False
+
class PluginClient(asyncore.dispatcher):
"""Send plugin messages to MC3P."""
@@ -124,6 +127,9 @@ def inject_msg(self, msg):
self.sendall(MC_short(len(msgbytes)))
self.sendall(msgbytes)
+ def writable(self):
+ return False
+
class PluginConfig(object):
"""Store plugin configuration"""
def __init__(self):

0 comments on commit 3c1009a

Please sign in to comment.
Something went wrong with that request. Please try again.