You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I decided against some of the goals there (for example, being able to stop, reconfigure, and restart the connection is a non-goal now). I want to keep the linear lifecycle (Connection goes from stopped, to connecting, to connected, possibly to sleeping in between reconnections, and then finally to quit / perma-stopped), but with some changes:
It should be possible to query the state of Connection at any point in this lifecycle (probably need to add an exported enum describing the states)
Connection should be in a valid state before the first (*Connection).Connect has completed (or before it has been called at all); no methods should panic on an out-of-order call here
The connection maintenance loop should start automatically; Loop() will still be provided as a compatibility alias but the preferred name for the new functionality (block until Quit() is called) will be Wait()
It should be possible to block until the connection is actually stopped. (We need a new QuitTimeout after which we forcibly close the socket.) Multiple concurrent Wait() operations should be possible, thus making it safe to Quit() and then Wait() from any goroutine.
The text was updated successfully, but these errors were encountered:
Concurrent calls to Connect() (or Reconnect()) should be safe (only one should succeed). A Reconnect() call that happens-before the first Connect() call should probably just become a Connect().
Context: autobrr/autobrr#1239 (comment)
I decided against some of the goals there (for example, being able to stop, reconfigure, and restart the connection is a non-goal now). I want to keep the linear lifecycle (
Connection
goes from stopped, to connecting, to connected, possibly to sleeping in between reconnections, and then finally to quit / perma-stopped), but with some changes:Connection
at any point in this lifecycle (probably need to add an exported enum describing the states)Connection
should be in a valid state before the first(*Connection).Connect
has completed (or before it has been called at all); no methods should panic on an out-of-order call hereLoop()
will still be provided as a compatibility alias but the preferred name for the new functionality (block untilQuit()
is called) will beWait()
QuitTimeout
after which we forcibly close the socket.) Multiple concurrentWait()
operations should be possible, thus making it safe toQuit()
and thenWait()
from any goroutine.The text was updated successfully, but these errors were encountered: