fixes #38. send() and sendall() seem to be good now (i think).

This commit is contained in:
Eugene Oden
2010-02-24 14:06:37 -05:00
parent 50f8d97213
commit 9496f6b974
2 changed files with 3 additions and 9 deletions

View File

@@ -282,11 +282,6 @@ class GreenSocket(object):
if self.act_non_blocking: if self.act_non_blocking:
return fd.send(data, flags) return fd.send(data, flags)
# XXX: need to deal with the exceptions that could be raised if the
# buffer is full (specifically the try/except below)
# need to test all of the conditions
# blocking socket behavior - sends all, blocks if the buffer is full # blocking socket behavior - sends all, blocks if the buffer is full
total_sent = 0 total_sent = 0
len_data = len(data) len_data = len(data)

View File

@@ -160,7 +160,6 @@ class TestGreenIo(LimitedTestCase):
def server(): def server():
# accept the connection in another greenlet # accept the connection in another greenlet
sock, addr = listener.accept() sock, addr = listener.accept()
bufsized(sock, 1)
eventlet.sleep(.5) eventlet.sleep(.5)
@@ -172,14 +171,14 @@ class TestGreenIo(LimitedTestCase):
client.settimeout(0.1) client.settimeout(0.1)
client.connect(addr) client.connect(addr)
bufsized(client, 1)
try: try:
msg = "A"*min_buf_size() msg = "A"*8192*1024
total_sent = 0
# want to exceed the size of the OS buffer so it'll block # want to exceed the size of the OS buffer so it'll block
for x in range(10): for x in range(10):
client.send(msg) total_sent += client.send(msg)
self.fail("socket.timeout not raised") self.fail("socket.timeout not raised")
except socket.timeout, e: except socket.timeout, e:
self.assert_(hasattr(e, 'args')) self.assert_(hasattr(e, 'args'))