~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/smart/protocol.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-12-18 23:21:58 UTC
  • mfrom: (4911.1.2 jam-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20091218232158-sc5b6z2upfgjf30u
(jam) Fix for -Dhpss server side. Threads don't have .get_ident(),
        and py2.4/2.5 don't have .ident, fallback to .getName()

Show diffs side-by-side

added added

removed removed

Lines of Context:
1147
1147
        self.response_sent = False
1148
1148
        self._headers = {'Software version': bzrlib.__version__}
1149
1149
        if 'hpss' in debug.debug_flags:
1150
 
            self._thread_id = threading.currentThread().get_ident()
 
1150
            # python 2.6 introduced 'ident' as a nice small integer to
 
1151
            # represent a thread. But it doesn't exist in 2.4/2.5
 
1152
            cur_thread = threading.currentThread()
 
1153
            self._thread_id = getattr(cur_thread, 'ident', None)
 
1154
            if self._thread_id is None:
 
1155
                self._thread_id = cur_thread.getName()
1151
1156
            self._response_start_time = None
1152
1157
 
1153
1158
    def _trace(self, action, message, extra_bytes=None, include_time=False):