Commit 2a862819 authored by Toby Dickenson's avatar Toby Dickenson

accumulate many strings into single call to send, to minimise the number of packets

parent 48c3c54a
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
"""Sized message async connections """Sized message async connections
""" """
__version__ = "$Revision: 1.17 $"[11:-2] __version__ = "$Revision: 1.18 $"[11:-2]
import asyncore, struct import asyncore, struct
from Exceptions import Disconnected from Exceptions import Disconnected
...@@ -138,6 +138,9 @@ class SizedMessageAsyncConnection(asyncore.dispatcher): ...@@ -138,6 +138,9 @@ class SizedMessageAsyncConnection(asyncore.dispatcher):
output = self.__output output = self.__output
while output: while output:
v = output[0] v = output[0]
while len(output)>1 and len(v)<16384:
del output[0]
v += output[0]
try: try:
n=self.send(v) n=self.send(v)
except socket.error, err: except socket.error, err:
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
"""Sized message async connections """Sized message async connections
""" """
__version__ = "$Revision: 1.17 $"[11:-2] __version__ = "$Revision: 1.18 $"[11:-2]
import asyncore, struct import asyncore, struct
from Exceptions import Disconnected from Exceptions import Disconnected
...@@ -138,6 +138,9 @@ class SizedMessageAsyncConnection(asyncore.dispatcher): ...@@ -138,6 +138,9 @@ class SizedMessageAsyncConnection(asyncore.dispatcher):
output = self.__output output = self.__output
while output: while output:
v = output[0] v = output[0]
while len(output)>1 and len(v)<16384:
del output[0]
v += output[0]
try: try:
n=self.send(v) n=self.send(v)
except socket.error, err: except socket.error, err:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment