diff options
author | Andrew M. Kuchling <amk@amk.ca> | 2000-09-08 20:30:39 (GMT) |
---|---|---|
committer | Andrew M. Kuchling <amk@amk.ca> | 2000-09-08 20:30:39 (GMT) |
commit | da85a272a6216cf3583db8e25155cb3a7168b081 (patch) | |
tree | 76bddf2d33c332513c9ee72ed2d8692d5e58e6b9 /Lib/asynchat.py | |
parent | 72e48bd05fac4b5fd813f68a692a044a2a85f797 (diff) | |
download | cpython-da85a272a6216cf3583db8e25155cb3a7168b081.zip cpython-da85a272a6216cf3583db8e25155cb3a7168b081.tar.gz cpython-da85a272a6216cf3583db8e25155cb3a7168b081.tar.bz2 |
Match Sam Rushing's current version of asyncore.py and asynchat.py
(SF patch 101447, fixing PR#113704)
Diffstat (limited to 'Lib/asynchat.py')
-rw-r--r-- | Lib/asynchat.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/asynchat.py b/Lib/asynchat.py index 4e02fa5..095cb70 100644 --- a/Lib/asynchat.py +++ b/Lib/asynchat.py @@ -1,5 +1,5 @@ # -*- Mode: Python; tab-width: 4 -*- -# Id: asynchat.py,v 2.23 1999/05/01 04:49:24 rushing Exp +# Id: asynchat.py,v 2.25 1999/11/18 11:01:08 rushing Exp # Author: Sam Rushing <rushing@nightmare.com> # ====================================================================== @@ -123,7 +123,9 @@ class async_chat (asyncore.dispatcher): index = string.find (self.ac_in_buffer, terminator) if index != -1: # we found the terminator - self.collect_incoming_data (self.ac_in_buffer[:index]) + if index > 0: + # don't bother reporting the empty string (source of subtle bugs) + self.collect_incoming_data (self.ac_in_buffer[:index]) self.ac_in_buffer = self.ac_in_buffer[index+terminator_len:] # This does the Right Thing if the terminator is changed here. self.found_terminator() @@ -220,10 +222,11 @@ class async_chat (asyncore.dispatcher): def discard_buffers (self): # Emergencies only! self.ac_in_buffer = '' - self.ac_out_buffer == '' + self.ac_out_buffer = '' while self.producer_fifo: self.producer_fifo.pop() + class simple_producer: def __init__ (self, data, buffer_size=512): @@ -287,7 +290,7 @@ class fifo: ## return result # yes, this is about twice as fast, but still seems -# to be negligible CPU. The previous could do about 290 +# to be negligible CPU. The previous version could do about 290 # searches/sec. the new one about 555/sec. import regex |