mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
reverting r88395 and r88387 as per http://mail.python.org/pipermail/python-dev/2011-February/108005.html
This commit is contained in:
parent
42e0b7f47e
commit
900d547047
1 changed files with 12 additions and 11 deletions
|
@ -218,9 +218,10 @@ def loop(timeout=30.0, use_poll=False, map=None, count=None):
|
||||||
|
|
||||||
class dispatcher:
|
class dispatcher:
|
||||||
|
|
||||||
|
debug = False
|
||||||
connected = False
|
connected = False
|
||||||
accepting = False
|
accepting = False
|
||||||
closed = False
|
closing = False
|
||||||
addr = None
|
addr = None
|
||||||
ignore_log_types = frozenset(['warning'])
|
ignore_log_types = frozenset(['warning'])
|
||||||
|
|
||||||
|
@ -393,16 +394,14 @@ class dispatcher:
|
||||||
raise
|
raise
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
if not self.closed:
|
self.connected = False
|
||||||
self.closed = True
|
self.accepting = False
|
||||||
self.connected = False
|
self.del_channel()
|
||||||
self.accepting = False
|
try:
|
||||||
self.del_channel()
|
self.socket.close()
|
||||||
try:
|
except socket.error as why:
|
||||||
self.socket.close()
|
if why.args[0] not in (ENOTCONN, EBADF):
|
||||||
except socket.error as why:
|
raise
|
||||||
if why.args[0] not in (ENOTCONN, EBADF):
|
|
||||||
raise
|
|
||||||
|
|
||||||
# cheap inheritance, used to pass all other attribute
|
# cheap inheritance, used to pass all other attribute
|
||||||
# references to the underlying socket object.
|
# references to the underlying socket object.
|
||||||
|
@ -545,6 +544,8 @@ class dispatcher_with_send(dispatcher):
|
||||||
return (not self.connected) or len(self.out_buffer)
|
return (not self.connected) or len(self.out_buffer)
|
||||||
|
|
||||||
def send(self, data):
|
def send(self, data):
|
||||||
|
if self.debug:
|
||||||
|
self.log_info('sending %s' % repr(data))
|
||||||
self.out_buffer = self.out_buffer + data
|
self.out_buffer = self.out_buffer + data
|
||||||
self.initiate_send()
|
self.initiate_send()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue