/// <summary> /// Disconnects from bancho. /// </summary> internal static void Disconnect(bool resetTimeout) { Authenticated = false; Connected = false; StreamingManager.Spectators.Clear(); StreamingManager.CurrentlySpectating = null; ChatEngine.ClearChannels(); if (resetTimeout) { pingTimeout = PING_TIMEOUT; } sendSequence = 0; ChatEngine.ResetUsers(); ResetReadArray(true); if (client == null || !client.Connected) { return; } try { new RequestGeneric(RequestType.Osu_Exit, null).Send(stream); } catch (Exception e) { Console.WriteLine(e.ToString()); } Requests.Clear(); if (client != null && client.Connected) { client.Close(); } }