Change ByPacket traffic to ConcurrentDictionary
This commit is contained in:
parent
069de32c29
commit
e5a1ade875
@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Net;
|
||||
using System.Threading;
|
||||
using System;
|
||||
@ -23,8 +24,8 @@ namespace NeonTea.Quakeball.TeaNet.Peers {
|
||||
|
||||
/// <summary>The amount of bytes sent since the last clear interval from Peer</summary>
|
||||
public int BytesSent;
|
||||
public Dictionary<Type, int> SentByPacket = new Dictionary<Type, int>();
|
||||
public Dictionary<Type, int> ReceivedByPacket = new Dictionary<Type, int>();
|
||||
public ConcurrentDictionary<Type, int> SentByPacket = new ConcurrentDictionary<Type, int>();
|
||||
public ConcurrentDictionary<Type, int> ReceivedByPacket = new ConcurrentDictionary<Type, int>();
|
||||
|
||||
public ConnectionManager(Peer peer) {
|
||||
Peer = peer;
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Concurrent;
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
@ -30,16 +31,16 @@ namespace NeonTea.Quakeball.TeaNet.Peers {
|
||||
ConnectionManager.Interval = value;
|
||||
}
|
||||
}
|
||||
/// <summary>The interval of traffic analyzed before updating</summary>
|
||||
public long TrafficDataInterval = 1000;
|
||||
/// <summary>The interval of traffic analyzed before updating. By default 5000 (5 seconds)</summary>
|
||||
public long TrafficDataInterval = 5000;
|
||||
/// <summary>The amount of bytes received in the last TrafficDataIntervel</summary>
|
||||
public int TrafficReceived { get; private set; }
|
||||
/// <summary>The amount of bytes sent in the last TrafficDataIntervel</summary>
|
||||
public int TrafficSent { get; private set; }
|
||||
/// <summary>The amount of bytes sent in the last TrafficDataIntervel by Packet</summary>
|
||||
public Dictionary<Type, int> TrafficSentByPacket => ConnectionManager.SentByPacket;
|
||||
public ConcurrentDictionary<Type, int> TrafficSentByPacket => ConnectionManager.SentByPacket;
|
||||
/// <summary>The amount of bytes received in the last TrafficDataIntervel by Packet</summary>
|
||||
public Dictionary<Type, int> TrafficReceivedByPacket => ConnectionManager.ReceivedByPacket;
|
||||
public ConcurrentDictionary<Type, int> TrafficReceivedByPacket => ConnectionManager.ReceivedByPacket;
|
||||
/// <summary>Whether the Peer is currently doing anything or not.null</sumary>
|
||||
public bool Running { get; private set; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user