Rev 3127: (andrew) Fix #115781 by passing no more than 64k at a time to in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Dec 19 03:39:27 GMT 2007


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 3127
revision-id:pqm at pqm.ubuntu.com-20071219033918-4r7sd1wllfw5oyf2
parent: pqm at pqm.ubuntu.com-20071218234130-061grgxsaf1g7bao
parent: andrew.bennetts at canonical.com-20071219024429-fs7rnw9jygo0bj6g
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2007-12-19 03:39:18 +0000
message:
  (andrew) Fix #115781 by passing no more than 64k at a time to
  	socket.sendall.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
  bzrlib/smart/medium.py         medium.py-20061103051856-rgu2huy59fkz902q-1
    ------------------------------------------------------------
    revno: 3118.2.2
    revision-id:andrew.bennetts at canonical.com-20071219024429-fs7rnw9jygo0bj6g
    parent: andrew.bennetts at canonical.com-20071219022526-pnpspp8dgbzso15n
    parent: pqm at pqm.ubuntu.com-20071218234130-061grgxsaf1g7bao
    committer: Andrew Bennetts <andrew.bennetts at canonical.com>
    branch nick: sendall-limit
    timestamp: Wed 2007-12-19 13:44:29 +1100
    message:
      Merge from bzr.dev.
    added:
      bzrlib/help_topics/            help_topics-20071211013603-qz0sojhgxhiujm6a-1
      bzrlib/help_topics/en/         bzrlibhelp-20071209214431-xzg3moksichjwyts-1
      bzrlib/version_info_formats/format_custom.py format_custom.py-20071029100350-ajovqhbpb5khf6gu-1
      doc/en/user-reference/readme.txt readme.txt-20071211133352-guencaey6fpesv4j-1
    renamed:
      bzrlib/help_topics.py => bzrlib/help_topics/__init__.py help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
      doc/en/user-guide/authentication_conf.txt => bzrlib/help_topics/en/authentication.txt authentication_conf.-20071104135035-glfv0ri355tyg1nf-1
      doc/en/user-guide/configuration.txt => bzrlib/help_topics/en/configuration.txt configuration.txt-20060314161707-868350809502af01
      doc/en/user-guide/conflicts.txt => bzrlib/help_topics/en/conflicts.txt conflicts.txt-20070723221841-ns3jvwxdb4okn6fk-1
      doc/en/user-reference/hooks.txt => bzrlib/help_topics/en/hooks.txt hooks.txt-20070830033044-xxu2rced13f72dka-1
    modified:
      .bzrignore                     bzrignore-20050311232317-81f7b71efa2db11a
      Makefile                       Makefile-20050805140406-d96e3498bb61c5bb
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/bugtracker.py           bugtracker.py-20070410073305-vu1vu1qosjurg8kb-1
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/bundle/serializer/v4.py v10.py-20070611062757-5ggj7k18s9dej0fr-1
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/cmd_version_info.py     __init__.py-20051228204928-697d01fdca29c99b
      bzrlib/diff.py                 diff.py-20050309040759-26944fbbf2ebbf36
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
      bzrlib/index.py                index.py-20070712131115-lolkarso50vjr64s-1
      bzrlib/inventory.py            inventory.py-20050309040759-6648b84ca2005b37
      bzrlib/lockable_files.py       control_files.py-20051111201905-bb88546e799d669f
      bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
      bzrlib/repofmt/knitrepo.py     knitrepo.py-20070206081537-pyy4a00xdas0j4pf-1
      bzrlib/repofmt/pack_repo.py    pack_repo.py-20070813041115-gjv5ma7ktfqwsjgn-1
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/revision.py             revision.py-20050309040759-e77802c08f3999d5
      bzrlib/symbol_versioning.py    symbol_versioning.py-20060105104851-9ecf8af605d15a80
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
      bzrlib/tests/blackbox/test_diff.py test_diff.py-20060110203741-aa99ac93e633d971
      bzrlib/tests/blackbox/test_non_ascii.py test_non_ascii.py-20060105214030-68010be784a5d854
      bzrlib/tests/blackbox/test_outside_wt.py test_outside_wt.py-20060116200058-98edd33e7db8bdde
      bzrlib/tests/repository_implementations/test_repository.py test_repository.py-20060131092128-ad07f494f5c9d26c
      bzrlib/tests/test_ancestry.py  test_ancestry.py-20050913023709-69768e94848312c6
      bzrlib/tests/test_graph.py     test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
      bzrlib/tests/test_help.py      test_help.py-20070419045354-6q6rq15j9e2n5fna-1
      bzrlib/tests/test_lockable_files.py test_lockable_files.py-20051225183927-365c7fd99591caf1
      bzrlib/tests/test_osutils.py   test_osutils.py-20051201224856-e48ee24c12182989
      bzrlib/tests/test_revision.py  testrevision.py-20050804210559-46f5e1eb67b01289
      bzrlib/tests/test_version_info.py test_version_info.py-20051228204928-2c364e30b702b41b
      bzrlib/tests/tree_implementations/test_inv.py test_inv.py-20070312023226-0cdvk5uwhutis9vg-1
      bzrlib/version_info_formats/__init__.py generate_version_info.py-20051228204928-8358edabcddcd97e
      doc/en/user-guide/browsing_history.txt browsing_history.txt-20071121073725-0corxykv5irjal00-2
      doc/en/user-guide/configuring_bazaar.txt configuring_bazaar.t-20071128000722-ncxiua259xwbdbg7-1
      doc/en/user-guide/hooks.txt    hooks.txt-20070829200551-7nr6e5a1io6x78uf-1
      doc/en/user-guide/index.txt    index.txt-20060622101119-tgwtdci8z769bjb9-2
      doc/en/user-guide/introducing_bazaar.txt introducing_bazaar.t-20071114035000-q36a9h57ps06uvnl-5
      doc/en/user-guide/sending_changes.txt sending_changes.txt-20071123154453-dk2mjhrg1vpjm5w2-4
      doc/en/user-guide/setting_up_email.txt setting_up_email.txt-20060314161707-fd242c8944346173
      doc/en/user-guide/version_info.txt version_info.txt-20060921215543-gju6o5xdic8w25np-1
      setup.py                       setup.py-20050314065409-02f8a0a6e3f9bc70
      tools/doc_generate/autodoc_rstx.py autodoc_rstx.py-20060420024836-3e0d4a526452193c
      bzrlib/help_topics/__init__.py help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
      bzrlib/help_topics/en/authentication.txt authentication_conf.-20071104135035-glfv0ri355tyg1nf-1
      bzrlib/help_topics/en/configuration.txt configuration.txt-20060314161707-868350809502af01
      bzrlib/help_topics/en/conflicts.txt conflicts.txt-20070723221841-ns3jvwxdb4okn6fk-1
      bzrlib/help_topics/en/hooks.txt hooks.txt-20070830033044-xxu2rced13f72dka-1
    ------------------------------------------------------------
    revno: 3118.2.1
    revision-id:andrew.bennetts at canonical.com-20071219022526-pnpspp8dgbzso15n
    parent: pqm at pqm.ubuntu.com-20071215210020-m28kk1qmbcc9n6qs
    committer: Andrew Bennetts <andrew.bennetts at canonical.com>
    branch nick: sendall-limit
    timestamp: Wed 2007-12-19 13:25:26 +1100
    message:
      (andrew) Fix #115781 by passing no more than 64k at a time to socket.sendall.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/osutils.py              osutils.py-20050309040759-eeaff12fbf77ac86
      bzrlib/smart/medium.py         medium.py-20061103051856-rgu2huy59fkz902q-1
=== modified file 'NEWS'
--- a/NEWS	2007-12-18 23:41:30 +0000
+++ b/NEWS	2007-12-19 02:44:29 +0000
@@ -43,6 +43,9 @@
    * Fixed Unicode encoding error in ``ignored`` when the output is
      redirected to a pipe. (Lukáš Lalinský)
 
+   * Fix traceback when sending large response bodies over the smart protocol
+     on Windows. (Andrew Bennetts, #115781)
+
    * Transform failures no longer cause ImmortalLimbo errors (Aaron Bentley,
      #137681)
 

=== modified file 'bzrlib/osutils.py'
--- a/bzrlib/osutils.py	2007-12-18 15:22:47 +0000
+++ b/bzrlib/osutils.py	2007-12-19 02:44:29 +0000
@@ -1407,6 +1407,17 @@
     return b
 
 
+def send_all(socket, bytes):
+    """Send all bytes on a socket.
+
+    Regular socket.sendall() can give socket error 10053 on Windows.  This
+    implementation sends no more than 64k at a time, which avoids this problem.
+    """
+    chunk_size = 2**16
+    for pos in xrange(0, len(bytes), chunk_size):
+        socket.sendall(bytes[pos:pos+chunk_size])
+
+
 def dereference_path(path):
     """Determine the real path to a file.
 

=== modified file 'bzrlib/smart/medium.py'
--- a/bzrlib/smart/medium.py	2007-12-03 16:39:11 +0000
+++ b/bzrlib/smart/medium.py	2007-12-19 02:25:26 +0000
@@ -30,6 +30,7 @@
 
 from bzrlib import (
     errors,
+    osutils,
     symbol_versioning,
     )
 from bzrlib.smart.protocol import (
@@ -177,7 +178,7 @@
         self.finished = True
 
     def _write_out(self, bytes):
-        self.socket.sendall(bytes)
+        osutils.send_all(self.socket, bytes)
 
 
 class SmartServerPipeStreamMedium(SmartServerStreamMedium):
@@ -524,7 +525,7 @@
     def _accept_bytes(self, bytes):
         """See SmartClientMedium.accept_bytes."""
         self._ensure_connection()
-        self._socket.sendall(bytes)
+        osutils.send_all(self._socket, bytes)
 
     def disconnect(self):
         """See SmartClientMedium.disconnect()."""




More information about the bazaar-commits mailing list