Skip to content

Instantly share code, notes, and snippets.

@GaretJax
Created July 26, 2010 10:48
Show Gist options
  • Save GaretJax/490411 to your computer and use it in GitHub Desktop.
Save GaretJax/490411 to your computer and use it in GitHub Desktop.
class FileSender(object):
...
def send_data(self):
chunk_size = 128 * 1024
data = self.source.read(chunk_size)
while data:
self.checksum.update(data)
yield self.client.send_data_chunk(data)
data = self.source.read(chunk_size)
def transfer(self):
deferreds = []
coop = task.Cooperator()
work = self.send_data()
return coop.coiterate(work)
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment