Rev 1322: Obtain new connection before creating thread to cope with possible exceptions being raised. in http://people.samba.org/bzr/jelmer/bzr-svn/0.4
Jelmer Vernooij
jelmer at samba.org
Mon Jun 23 19:15:44 BST 2008
At http://people.samba.org/bzr/jelmer/bzr-svn/0.4
------------------------------------------------------------
revno: 1322
revision-id: jelmer at samba.org-20080623181542-w17ofdsh92qjarfq
parent: jelmer at samba.org-20080623154018-gjpb8ytgkrqzrhfu
committer: Jelmer Vernooij <jelmer at samba.org>
branch nick: 0.4
timestamp: Mon 2008-06-23 20:15:42 +0200
message:
Obtain new connection before creating thread to cope with possible exceptions being raised.
modified:
transport.py transport.py-20060406231150-b3472d06b3a0818d
=== modified file 'transport.py'
--- a/transport.py 2008-06-23 03:18:12 +0000
+++ b/transport.py 2008-06-23 18:15:42 +0000
@@ -234,8 +234,9 @@
self.args = args
self.kwargs = kwargs
self.pending = []
- self.conn = None
+ self.conn = self.transport.get_connection()
self.semaphore = Semaphore(0)
+ self.busy = False
def next(self):
self.semaphore.acquire()
@@ -248,11 +249,11 @@
return ret
def run(self):
- assert self.conn is None, "already running"
+ assert not self.busy, "already running"
+ self.busy = True
def rcvr(*args):
self.pending.append(args)
self.semaphore.release()
- self.conn = self.transport.get_connection()
try:
self.conn.get_log(callback=rcvr, *self.args, **self.kwargs)
self.pending.append(None)
More information about the bazaar-commits
mailing list