The Grande 'sendall()' patch, copied from release21-maint. Fixes #516715.

Replaces calls to socket.send() (which isn't guaranteed to send all data)
with the new socket.sendall() method.
This commit is contained in:
Martin v. Löwis 2002-02-16 23:06:19 +00:00
parent 976ade691c
commit e12454f44a
9 changed files with 15 additions and 24 deletions

View file

@ -269,7 +269,7 @@ class Telnet:
if IAC in buffer:
buffer = buffer.replace(IAC, IAC+IAC)
self.msg("send %s", `buffer`)
self.sock.send(buffer)
self.sock.sendall(buffer)
def read_until(self, match, timeout=None):
"""Read until a given string is encountered or until timeout.
@ -411,7 +411,7 @@ class Telnet:
if self.option_callback:
self.option_callback(self.sock, c, opt)
else:
self.sock.send(IAC + WONT + opt)
self.sock.sendall(IAC + WONT + opt)
elif c in (WILL, WONT):
opt = self.rawq_getchar()
self.msg('IAC %s %d',
@ -419,7 +419,7 @@ class Telnet:
if self.option_callback:
self.option_callback(self.sock, c, opt)
else:
self.sock.send(IAC + DONT + opt)
self.sock.sendall(IAC + DONT + opt)
else:
self.msg('IAC %d not recognized' % ord(opt))
except EOFError: # raised by self.rawq_getchar()