changeset 96:68598f164855

Another refactoring: dispatcher calls instruction.execute() now.
author Atul Varma <varmaa@toolness.com>
date Fri, 01 May 2009 23:47:06 -0700
parents 57681224a62a
children 0d3dd2ab36cd
files cosocket.py
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/cosocket.py	Fri May 01 23:41:52 2009 -0700
+++ b/cosocket.py	Fri May 01 23:47:06 2009 -0700
@@ -108,7 +108,7 @@
                 self.__coroutine = instruction
                 self.continue_from_yield()
             else:
-                instruction.execute(self.__handler)
+                self.__handler.handle_coroutine_instruction(instruction)
 
 class _AsyncChatCoroutineDispatcher(asynchat.async_chat):
     def __init__(self, coroutine, conn = None):
@@ -122,6 +122,9 @@
         if conn:
             self.trampoline.continue_from_yield()
 
+    def handle_coroutine_instruction(self, instruction):
+        instruction.execute(self)
+
     def handle_coroutine_complete(self):
         self.handle_close()