Merge pull request #283 from dw/recv-race

core: race during Receiver construction.
pull/284/head
dw 7 years ago committed by GitHub
commit c1d70b6ea9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -469,6 +469,7 @@ class Receiver(object):
respondent=None, policy=None): respondent=None, policy=None):
self.router = router self.router = router
self.handle = handle # Avoid __repr__ crash in add_handler() self.handle = handle # Avoid __repr__ crash in add_handler()
self._latch = Latch() # Must exist prior to .add_handler()
self.handle = router.add_handler( self.handle = router.add_handler(
fn=self._on_receive, fn=self._on_receive,
handle=handle, handle=handle,
@ -476,7 +477,6 @@ class Receiver(object):
persist=persist, persist=persist,
respondent=respondent, respondent=respondent,
) )
self._latch = Latch()
def __repr__(self): def __repr__(self):
return 'Receiver(%r, %r)' % (self.router, self.handle) return 'Receiver(%r, %r)' % (self.router, self.handle)

Loading…
Cancel
Save