A race can happen while a consumer or a producer is registering itself to the connection to later receive closing notification.
Modifications
This pull request changes the concurrency model of the connection to properly lock the different actors between the closing procedure and the registration of handlers and listeners. After this, a caller will properly check the state of the connection and aborts if closed, and it will be certain that it will not be registered in concurrency with a closing.
Verifying this change
[x] Make sure that the change passes the CI checks.
This change is already covered by existing tests.
Does this pull request potentially affect one of the following parts:
Fixes #1274
Motivation
A race can happen while a consumer or a producer is registering itself to the connection to later receive closing notification.
Modifications
This pull request changes the concurrency model of the connection to properly lock the different actors between the closing procedure and the registration of handlers and listeners. After this, a caller will properly check the state of the connection and aborts if closed, and it will be certain that it will not be registered in concurrency with a closing.
Verifying this change
This change is already covered by existing tests.
Does this pull request potentially affect one of the following parts:
none
Documentation
none