public void Dispose() { if (IsCreated) { var connections = m_Connections.GetValueArray(Allocator.Temp); foreach (var con in connections) { if (!Listening && Library.Initialized) { m_Sockets.CloseConnection(con.Id); } con.Dispose(); } if (Listening && Library.Initialized) { m_Sockets.CloseListenSocket(m_ListeningSocket); } } m_Connections.Dispose(); m_QueuedConnections.Dispose(); m_PipelineReliableIds.Dispose(); m_PipelineUnreliableIds.Dispose(); m_DataStream.Dispose(); }
void OnApplicationQuit() { server.CloseListenSocket(listenSocket); Library.Deinitialize(); }