public static GeneralStatistics GetGeneralStatistics(StatisticsQueryFlags queryFlags) { GeneralStatistics stat = new GeneralStatistics(); stat.QueryFlags = queryFlags; if ((queryFlags & StatisticsQueryFlags.Connections) != 0) { int connections = 0; foreach (var conn in HTTPManager.Connections) { if (conn.Value != null) { connections += conn.Value.Count; } } #if !BESTHTTP_DISABLE_WEBSOCKET && UNITY_WEBGL && !UNITY_EDITOR connections += WebSocket.WebSocket.WebSockets.Count; #endif stat.Connections = connections; stat.ActiveConnections = ActiveConnections.Count #if !BESTHTTP_DISABLE_WEBSOCKET && UNITY_WEBGL && !UNITY_EDITOR + WebSocket.WebSocket.WebSockets.Count #endif ; stat.FreeConnections = FreeConnections.Count; stat.RecycledConnections = RecycledConnections.Count; stat.RequestsInQueue = RequestQueue.Count; } #if !BESTHTTP_DISABLE_CACHING && (!UNITY_WEBGL || UNITY_EDITOR) if ((queryFlags & StatisticsQueryFlags.Cache) != 0) { stat.CacheEntityCount = HTTPCacheService.GetCacheEntityCount(); stat.CacheSize = HTTPCacheService.GetCacheSize(); } #endif #if !BESTHTTP_DISABLE_COOKIES && (!UNITY_WEBGL || UNITY_EDITOR) if ((queryFlags & StatisticsQueryFlags.Cookies) != 0) { List <Cookies.Cookie> cookies = Cookies.CookieJar.GetAll(); stat.CookieCount = cookies.Count; uint cookiesSize = 0; for (int i = 0; i < cookies.Count; ++i) { cookiesSize += cookies[i].GuessSize(); } stat.CookieJarSize = cookiesSize; } #endif return(stat); }
public static GeneralStatistics GetGeneralStatistics(StatisticsQueryFlags queryFlags) { GeneralStatistics stat = new GeneralStatistics(); stat.QueryFlags = queryFlags; if ((queryFlags & StatisticsQueryFlags.Connections) != 0) { int connections = 0; foreach (var conn in HTTPManager.Connections) { if (conn.Value != null) { connections += conn.Value.Count; } } stat.Connections = connections; stat.ActiveConnections = ActiveConnections.Count; stat.FreeConnections = FreeConnections.Count; stat.RecycledConnections = RecycledConnections.Count; stat.RequestsInQueue = RequestQueue.Count; } if ((queryFlags & StatisticsQueryFlags.Cache) != 0) { stat.CacheEntityCount = HTTPCacheService.GetCacheEntityCount(); stat.CacheSize = HTTPCacheService.GetCacheSize(); } if ((queryFlags & StatisticsQueryFlags.Cookies) != 0) { List <Cookies.Cookie> cookies = Cookies.CookieJar.GetAll(); stat.CookieCount = cookies.Count; uint cookiesSize = 0; for (int i = 0; i < cookies.Count; ++i) { cookiesSize += cookies [i].GuessSize(); } stat.CookieJarSize = cookiesSize; } return(stat); }
public static GeneralStatistics GetGeneralStatistics(StatisticsQueryFlags queryFlags) { GeneralStatistics result = default(GeneralStatistics); result.QueryFlags = queryFlags; if ((byte)(queryFlags & StatisticsQueryFlags.Connections) != 0) { int num = 0; foreach (KeyValuePair <string, List <HTTPConnection> > current in HTTPManager.Connections) { if (current.Value != null) { num += current.Value.Count; } } result.Connections = num; result.ActiveConnections = HTTPManager.ActiveConnections.Count; result.FreeConnections = HTTPManager.FreeConnections.Count; result.RecycledConnections = HTTPManager.RecycledConnections.Count; result.RequestsInQueue = HTTPManager.RequestQueue.Count; } if ((byte)(queryFlags & StatisticsQueryFlags.Cache) != 0) { result.CacheEntityCount = HTTPCacheService.GetCacheEntityCount(); result.CacheSize = HTTPCacheService.GetCacheSize(); } if ((byte)(queryFlags & StatisticsQueryFlags.Cookies) != 0) { List <Cookie> all = CookieJar.GetAll(); result.CookieCount = all.Count; uint num2 = 0u; for (int i = 0; i < all.Count; i++) { num2 += all[i].GuessSize(); } result.CookieJarSize = num2; } return(result); }
public static GeneralStatistics GetGeneralStatistics(StatisticsQueryFlags queryFlags) { GeneralStatistics stat = new GeneralStatistics(); stat.QueryFlags = queryFlags; if ((queryFlags & StatisticsQueryFlags.Connections) != 0) { int connections = 0; foreach(var conn in HTTPManager.Connections) { if (conn.Value != null) connections += conn.Value.Count; } stat.Connections = connections; stat.ActiveConnections = ActiveConnections.Count; stat.FreeConnections = FreeConnections.Count; stat.RecycledConnections = RecycledConnections.Count; stat.RequestsInQueue = RequestQueue.Count; } #if !BESTHTTP_DISABLE_CACHING if ((queryFlags & StatisticsQueryFlags.Cache) != 0) { stat.CacheEntityCount = HTTPCacheService.GetCacheEntityCount(); stat.CacheSize = HTTPCacheService.GetCacheSize(); } #endif #if !BESTHTTP_DISABLE_COOKIES if ((queryFlags & StatisticsQueryFlags.Cookies) != 0) { List<Cookies.Cookie> cookies = Cookies.CookieJar.GetAll(); stat.CookieCount = cookies.Count; uint cookiesSize = 0; for (int i = 0; i < cookies.Count; ++i) cookiesSize += cookies[i].GuessSize(); stat.CookieJarSize = cookiesSize; } #endif return stat; }