noodlefrenzy / node-amqp10

amqp10 is a promise-based, AMQP 1.0 compliant node.js client
MIT License
134 stars 56 forks source link

fix(session): unmap session when connection is updated #354

Closed princjef closed 6 years ago

princjef commented 6 years ago

When the connection is changed in a session, it is effectively unmapped since the connection for which it is mapped is no longer associated with it. This wasn't an issue (besides the accumulation of AMQP sessions) until we started validating the session state on begin(). This change watches for changes to the connection for the session and updates the state accordingly to make the behavior consistent with the previous behavior.

As a side note: I tried to use the existing test harness to write a unit test exercising this case, but could not get it to behave and tear down correctly after several hours so I'm giving up on it for now. I have verified the fix manually for now.


This change is Reviewable

amarzavery commented 6 years ago

Lgtm