-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Replace Connection.Closed
event with Connection.StateUpdated
#892
Comments
This makes a lot more sense to me than the current way we are doing it! |
I think: has too many states, and the names are not consistent. Take the first 3, it should be: not some mix. And nobody will understand the distinction ShuttingDown / Closing. |
Or a related note, I think we should move the event registration to |
It would be good to outline a use-case for each of these state transitions. If there is no use-case, we probably don't need the state. For example, assuming My understanding is all these events execute synchronously and serially. |
One use case is a GUI notification, such as client using a resumable connection where the I agree that To me, from an application perspective the following would be the simplest: The state names are independent of the API method names however so it might be obvious when these state changes are triggered (knowing that they can be triggered explicitly through API calls or implicitly by the core). |
I find having both The
|
Today, it's not a transient state since a resumable connection always goes back to the But yes, we could still remove it and instead create the connection with the |
I see the following stable connection states. "stable" meaning a connection can stay in that state for hours and all is fine.
Only a resumable connection can be in the Disconnected state. The Disconnected state is very similar to the Initial state. The difference today is the Features of the Connection in the initial state is empty whereas in the Disconnected state it's the Features from the previous connected state. There are also transitional states - when transitioning to a stable state:
We can't just discount these states and immediately "jump" to Connected or Closed. For example, when you call ConnectAsync, the behavior is and should be different when the state is Initial, Connected or Connecting (= you wait for the previous ConnectAsync to complete). We need to provide methods for these state transitions (and we already do):
Some state transitions can occur without an explicit method call. For example, if the underlying connection drops, Connection transitions automatically to Disconnected or Closed. |
No longer relevant. |
A
StateUpdated
event would be more useful than the existingClosed
event.A question however is which state we should report to the applications.
A non-resumable connection goes through the following states:
NotConnected
->Connecting
->Active
->ShuttingDown
->Closing
->Closed
. TheClosed
state if final. It doesn't go through theShuttingDown
state if the application explicitly callsCloseAsync
or if the connection is lost.I think these states are fine to report through for the
StateUpdated
event of non-resumable connections.Today, a resumable connection goes through the following states:
NotConnected
->Connecting
->Active
->Closing
->NotClosed
if the connection is lost or ifCloseAsync
is calledNotConnected
->Connecting
->Active
->ShuttingDown
->Closing
->NotConnected
ifShutdownAsync
is calledNotConnected
->Connecting
->Active
->ShuttingDown
->Closing
->Closed
ifDisposeAsync
is called.But note that there's some discussions on #891 and in particular if this should instead be the following for resumable connections:
NotConnected
->Connecting
->Active
->Closing
->NotConnected
if the connection is lost.NotConnected
->Connecting
->Active
->ShuttingDown
->Closing
->Closed
ifShutdownAsync
orDisposeAsync
is called. IfCloseAsync
is called, it doesn't go through theShuttingDown
state.From an application perspective, I think the second option is better for resumable connections.
The text was updated successfully, but these errors were encountered: