Repair error in local OID allocation when publishing a local bootstrap service

This commit is contained in:
Tony Garnock-Jones 2021-11-30 20:43:03 +01:00
parent 62a1779dc1
commit 00ae6b3afb
2 changed files with 6 additions and 5 deletions

View File

@ -5,7 +5,7 @@ except ImportError:
setup(
name="syndicate-py",
version="0.2.1",
version="0.2.2",
author="Tony Garnock-Jones",
author_email="tonyg@leastfixedpoint.com",
license="GNU General Public License v3 or later (GPLv3+)",

View File

@ -18,8 +18,6 @@ class InboundAssertion:
self.local_handle = local_handle
self.pins = pins
_next_local_oid = IdGenerator()
class WireSymbol:
def __init__(self, oid, ref, membrane):
self.oid = oid
@ -98,7 +96,10 @@ class TunnelRelay:
self.pending_turn = []
self._connected = False
self.gatekeeper_handle = None
if self.publish_service is not None:
if self.publish_service is None:
self.next_local_oid = IdGenerator(initial_value=0)
else:
self.next_local_oid = IdGenerator(initial_value=1)
# Very specific specialization of logic in rewrite_ref_out
ws = WireSymbol(self.publish_oid, self.publish_service, self.exported_references)
self.exported_references.get_ref([], self.publish_service, False, lambda: ws)
@ -138,7 +139,7 @@ class TunnelRelay:
return sturdy.WireRef.yours(sturdy.Oid(r.entity.oid), ())
else:
ws = self.exported_references.get_ref(
pins, r, is_transient, lambda: WireSymbol(next(_next_local_oid), r,
pins, r, is_transient, lambda: WireSymbol(next(self.next_local_oid), r,
self.exported_references))
return sturdy.WireRef.mine(sturdy.Oid(ws.oid))