Use StreamRequestHandler.
authorEric S. Raymond <esr@thyrsus.com>
Sun, 26 Aug 2012 17:54:16 +0000 (13:54 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Sun, 26 Aug 2012 17:54:16 +0000 (13:54 -0400)
irker.py

index 12e1da39aa2c1e4a918591d69014dc77327124c5..450b738c835d8f4a19142e8690614ebd590d9259 100755 (executable)
--- a/irker.py
+++ b/irker.py
@@ -126,10 +126,9 @@ class Irker:
         for session in self.sessions.values():
             session.await()
 
-class MyTCPHandler(SocketServer.BaseRequestHandler):
+class MyTCPHandler(SocketServer.StreamRequestHandler):
     def handle(self):
-        # self.request is the TCP socket connected to the client
-        irker.handle(self.request.recv(1024).strip())
+        irker.handle(self.rfile.readline().strip())
 
 if __name__ == '__main__':
     host = HOST