add comment

This commit is contained in:
vis2k 2021-05-10 21:33:38 +08:00
parent 939f2820ea
commit 9b2e7d09c7

View File

@ -64,6 +64,23 @@ internal NetworkConnection(int networkConnectionId) : this()
}
/// <summary>Disconnects this connection.</summary>
// for future reference, here is how Disconnects work in Mirror.
//
// first, there are two types of disconnects:
// * voluntary: the other end simply disconnected
// * involuntary: server disconnects a client by itself
//
// UNET had special (complex) code to handle both cases differently.
//
// Mirror handles both cases the same way:
// * Disconnect is called from TOP to BOTTOM
// NetworkServer/Client -> NetworkConnection -> Transport.Disconnect()
// * Disconnect is handled from BOTTOM to TOP
// Transport.OnDisconnected -> ...
//
// in other words, calling Disconnect() does no cleanup whatsoever.
// it simply asks the transport to disconnect.
// then later the transport events will do the clean up.
public abstract void Disconnect();
internal void SetHandlers(Dictionary<ushort, NetworkMessageDelegate> handlers)