[Lyntin-cvs] CVS: lyntinng/errata testserver.py,1.9,1.10
Brought to you by:
glasssnake,
willhelm
From: will g. <wil...@us...> - 2002-05-18 23:32:03
|
Update of /cvsroot/lyntin/lyntinng/errata In directory usw-pr-cvs1:/tmp/cvs-serv28261/errata Modified Files: testserver.py Log Message: Adjustments to testserver--it still has problems with sucking up cpu after you connect to it. Minor change to highlight. Index: testserver.py =================================================================== RCS file: /cvsroot/lyntin/lyntinng/errata/testserver.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -r1.9 -r1.10 *** testserver.py 9 May 2002 23:20:12 -0000 1.9 --- testserver.py 18 May 2002 23:32:00 -0000 1.10 *************** *** 43,46 **** --- 43,47 ---- self._commands["text"] = self.handle_text self._commands["spam"] = self.handle_spam + self._commands["hltest"] = self.handle_coloredline self._rlist = [self.request] *************** *** 62,71 **** import select try: ! self.request.setblocking(0) data = '' while shutdown == 0: #check to see what is ready on the socket conns = select.select([self.request], [], [], 0)[0] - for mem in conns: #lets get the message --- 63,71 ---- import select try: ! self.request.setblocking(1) data = '' while shutdown == 0: #check to see what is ready on the socket conns = select.select([self.request], [], [], 0)[0] for mem in conns: #lets get the message *************** *** 135,138 **** --- 135,145 ---- self.write(response) + def handle_coloredline(self, text): + output = "Notadragon is not a dragon.\n" + output += "Notadragon is " + self.color("not", 32) + " a dragon.\n" + output += "N" + self.color("otadragon", 35) + " is not a " + self.color("dragon.", 33) + "\n" + output += "Beginning of line " + self.color("Hunted by: ", 35) + self.color("No-one", 37) + " rest of line." + self.write(output) + def handle_text(self, text): # TEXT command -> returns 10 lines of 10 words |