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
New sessions are created on connect, then registered in the dictionary, and unregistered on disconnect, but never explicitly disposed.
Are you relying on the GC to dispose of the sessions?
Is this really a good idea as they contain managed resources, i.e. socket and state objects.
Since it is not possible to "delete this" in C# (as far as I know), typical async implementations would mark sessions as stale, and periodically delete all stale sessions, or mark them for reuse, in a timer or cleanup loop.
The text was updated successfully, but these errors were encountered:
There is no need to dispose TcpSession/SslSession as they will dispose wrapped Socket in public virtual bool Disconnect() method. Other wrapped resources are not support IDisposable and will be managed by GC.
Sessions are disconnected by system network layer (e.g. when remote peer disconnects or network hangs) or when the server stops with DisconnectAll() method. As the result sockets resources will be disposed. But sessions objects and their buffers will be handled by GC later as they are not IDisposable.
New sessions are created on connect, then registered in the dictionary, and unregistered on disconnect, but never explicitly disposed.
Are you relying on the GC to dispose of the sessions?
Is this really a good idea as they contain managed resources, i.e. socket and state objects.
Since it is not possible to "delete this" in C# (as far as I know), typical async implementations would mark sessions as stale, and periodically delete all stale sessions, or mark them for reuse, in a timer or cleanup loop.
The text was updated successfully, but these errors were encountered: