From 49d84f7cfc08b7ffe28a0890baf11aed985e8bf2 Mon Sep 17 00:00:00 2001 From: Bob Lantz Date: Thu, 10 May 2012 17:35:34 -0700 Subject: [PATCH] Fix poller to only check if stdin and node are readable. Fixes busy waiting and excessive CPU usage in CLI. Thanks to James Zeng for pointing this out! --- mininet/cli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mininet/cli.py b/mininet/cli.py index 3fbedd1..5843e95 100644 --- a/mininet/cli.py +++ b/mininet/cli.py @@ -319,8 +319,8 @@ class CLI( Cmd ): nodePoller = poll() nodePoller.register( node.stdout ) bothPoller = poll() - bothPoller.register( self.stdin ) - bothPoller.register( node.stdout ) + bothPoller.register( self.stdin, POLLIN ) + bothPoller.register( node.stdout, POLLIN ) if self.isatty(): # Buffer by character, so that interactive # commands sort of work