/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/smart/protocol.py

  • Committer: John Arbash Meinel
  • Date: 2009-12-15 22:17:09 UTC
  • mto: This revision was merged to the branch mainline in revision 4903.
  • Revision ID: john@arbash-meinel.com-20091215221709-h01xw9ud6r7xoc5p
Change the amount buffered to be a 'constant' that we can get at.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006, 2007 Canonical Ltd
 
1
# Copyright (C) 2006, 2007, 2008, 2009 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
1062
1062
class _ProtocolThreeEncoder(object):
1063
1063
 
1064
1064
    response_marker = request_marker = MESSAGE_VERSION_THREE
 
1065
    BUFFER_SIZE = 1024*1024 # 1 MiB buffer before flushing
1065
1066
 
1066
1067
    def __init__(self, write_func):
1067
1068
        self._buf = []
1071
1072
    def _write_func(self, bytes):
1072
1073
        self._buf.append(bytes)
1073
1074
        self._buf_len += len(bytes)
1074
 
        if self._buf_len > 1*1024*1024:
 
1075
        if self._buf_len > self.BUFFER_SIZE:
1075
1076
            self.flush()
1076
1077
 
1077
1078
    def flush(self):