本文整理汇总了C#中ThrottleOutPacketType类的典型用法代码示例。如果您正苦于以下问题:C# ThrottleOutPacketType类的具体用法?C# ThrottleOutPacketType怎么用?C# ThrottleOutPacketType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ThrottleOutPacketType类属于命名空间,在下文中一共展示了ThrottleOutPacketType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: OutgoingPacket
/// <summary>
/// Default constructor
/// </summary>
/// <param name="client">Reference to the client this packet is destined for</param>
/// <param name="buffer">Serialized packet data. If the flags or sequence number
/// need to be updated, they will be injected directly into this binary buffer</param>
/// <param name="category">Throttling category for this packet</param>
public OutgoingPacket(LLUDPClient client, UDPPacketBuffer buffer, ThrottleOutPacketType category, UnackedPacketMethod method)
{
Client = client;
Buffer = buffer;
Category = category;
UnackedMethod = method;
}
开发者ID:BogusCurry,项目名称:arribasim-dev,代码行数:14,代码来源:OutgoingPacket.cs
示例2: OutgoingPacket
/// <summary>
/// Default constructor
/// </summary>
/// <param name="client">Reference to the client this packet is destined for</param>
/// <param name="buffer">Serialized packet data. If the flags or sequence number
/// need to be updated, they will be injected directly into this binary buffer</param>
/// <param name="category">Throttling category for this packet</param>
/// <param name="resendMethod">The delegate to be called if this packet is determined to be unacknowledged</param>
/// <param name="finishedMethod">The delegate to be called when this packet is sent</param>
public OutgoingPacket(LLUDPClient client, UDPPacketBuffer buffer,
ThrottleOutPacketType category, UnackedPacketMethod resendMethod,
UnackedPacketMethod finishedMethod, Packet packet)
{
Client = client;
Buffer = buffer;
Category = category;
UnackedMethod = resendMethod;
FinishedMethod = finishedMethod;
Packet = packet;
}
开发者ID:NickyPerian,项目名称:Aurora-Sim,代码行数:20,代码来源:OutgoingPacket.cs
示例3: SendPacket
public void SendPacket(LLUDPClient udpClient, Packet packet, ThrottleOutPacketType category, bool allowSplitting,
UnackedPacketMethod resendMethod, UnackedPacketMethod finishedMethod)
{
// CoarseLocationUpdate packets cannot be split in an automated way
if (packet.Type == PacketType.CoarseLocationUpdate && allowSplitting)
allowSplitting = false;
if (allowSplitting && packet.HasVariableBlocks)
{
byte[][] datas = packet.ToBytesMultiple();
int packetCount = datas.Length;
if (packetCount < 1)
MainConsole.Instance.Error("[LLUDPSERVER]: Failed to split " + packet.Type +
" with estimated length " +
packet.Length);
for (int i = 0; i < packetCount; i++)
{
byte[] data = datas[i];
SendPacketData(udpClient, data, packet, category, resendMethod, finishedMethod);
data = null;
}
datas = null;
}
else
{
byte[] data = packet.ToBytes();
SendPacketData(udpClient, data, packet, category, resendMethod, finishedMethod);
data = null;
}
packet = null;
}
开发者ID:BogusCurry,项目名称:WhiteCore-Dev,代码行数:33,代码来源:LLUDPServer.cs
示例4: MeshCapsDataThrottler
public MeshCapsDataThrottler(int pBytes, int max, int min, Scene pScene, UUID puser)
{
ThrottleBytes = pBytes;
lastTimeElapsed = Util.EnvironmentTickCount();
Throttle = ThrottleOutPacketType.Asset;
m_scene = pScene;
User = puser;
}
开发者ID:CassieEllen,项目名称:opensim,代码行数:8,代码来源:GetMeshModule.cs
示例5: GetLimit
public int GetLimit(ThrottleOutPacketType type)
{
switch (type)
{
case ThrottleOutPacketType.Resend:
return ResendLimit;
case ThrottleOutPacketType.Land:
return LandLimit;
case ThrottleOutPacketType.Wind:
return WindLimit;
case ThrottleOutPacketType.Cloud:
return CloudLimit;
case ThrottleOutPacketType.Task:
return TaskLimit;
case ThrottleOutPacketType.Texture:
return TextureLimit;
case ThrottleOutPacketType.Asset:
return AssetLimit;
case ThrottleOutPacketType.Transfer:
return TransferLimit;
case ThrottleOutPacketType.State:
return StateLimit;
case ThrottleOutPacketType.AvatarInfo:
return AvatarInfoLimit;
default:
return 0;
}
}
开发者ID:x8ball,项目名称:Aurora-Sim,代码行数:28,代码来源:ThrottleRates.cs
示例6: SendPacket
/// <summary>
/// Start the process of sending a packet to the client.
/// </summary>
/// <param name="udpClient"></param>
/// <param name="packet"></param>
/// <param name="category"></param>
/// <param name="allowSplitting"></param>
/// <param name="method">
/// The method to call if the packet is not acked by the client. If null, then a standard
/// resend of the packet is done.
/// </param>
public virtual void SendPacket(
LLUDPClient udpClient, Packet packet, ThrottleOutPacketType category, bool allowSplitting, UnackedPacketMethod method)
{
// CoarseLocationUpdate packets cannot be split in an automated way
if (packet.Type == PacketType.CoarseLocationUpdate && allowSplitting)
allowSplitting = false;
if (allowSplitting && packet.HasVariableBlocks)
{
byte[][] datas = packet.ToBytesMultiple();
int packetCount = datas.Length;
if (packetCount < 1)
m_log.Error("[LLUDPSERVER]: Failed to split " + packet.Type + " with estimated length " + packet.Length);
for (int i = 0; i < packetCount; i++)
{
byte[] data = datas[i];
SendPacketData(udpClient, data, packet.Type, category, method);
}
}
else
{
byte[] data = packet.ToBytes();
SendPacketData(udpClient, data, packet.Type, category, method);
}
PacketPool.Instance.ReturnPacket(packet);
m_dataPresentEvent.Set();
}
开发者ID:JeffCost,项目名称:opensim,代码行数:42,代码来源:LLUDPServer.cs
示例7: SendPacketData
public void SendPacketData(LLUDPClient udpClient, byte[] data, Packet packet, ThrottleOutPacketType category, UnackedPacketMethod resendMethod, UnackedPacketMethod finishedMethod)
{
int dataLength = data.Length;
bool doZerocode = (data[0] & Helpers.MSG_ZEROCODED) != 0;
bool doCopy = true;
// Frequency analysis of outgoing packet sizes shows a large clump of packets at each end of the spectrum.
// The vast majority of packets are less than 200 bytes, although due to asset transfers and packet splitting
// there are a decent number of packets in the 1000-1140 byte range. We allocate one of two sizes of data here
// to accomodate for both common scenarios and provide ample room for ACK appending in both
int bufferSize = dataLength * 2;
UDPPacketBuffer buffer = new UDPPacketBuffer(udpClient.RemoteEndPoint, bufferSize);
// Zerocode if needed
if (doZerocode)
{
try
{
dataLength = Helpers.ZeroEncode(data, dataLength, buffer.Data);
doCopy = false;
}
catch (IndexOutOfRangeException)
{
// The packet grew larger than the bufferSize while zerocoding.
// Remove the MSG_ZEROCODED flag and send the unencoded data
// instead
m_log.Info("[LLUDPSERVER]: Packet exceeded buffer size during zerocoding for " + packet.Type + ". DataLength=" + dataLength +
" and BufferLength=" + buffer.Data.Length + ". Removing MSG_ZEROCODED flag");
data[0] = (byte)(data[0] & ~Helpers.MSG_ZEROCODED);
}
}
// If the packet data wasn't already copied during zerocoding, copy it now
if (doCopy)
{
if (dataLength <= buffer.Data.Length)
{
Buffer.BlockCopy(data, 0, buffer.Data, 0, dataLength);
}
else
{
bufferSize = dataLength;
buffer = new UDPPacketBuffer(udpClient.RemoteEndPoint, bufferSize);
// m_log.Error("[LLUDPSERVER]: Packet exceeded buffer size! This could be an indication of packet assembly not obeying the MTU. Type=" +
// type + ", DataLength=" + dataLength + ", BufferLength=" + buffer.Data.Length + ". Dropping packet");
Buffer.BlockCopy(data, 0, buffer.Data, 0, dataLength);
}
}
buffer.DataLength = dataLength;
#region Queue or Send
OutgoingPacket outgoingPacket = new OutgoingPacket(udpClient, buffer, category, resendMethod, finishedMethod, packet);
if (!outgoingPacket.Client.EnqueueOutgoing(outgoingPacket))
SendPacketFinal(outgoingPacket);
#endregion Queue or Send
}
开发者ID:HGExchange,项目名称:Aurora-Sim,代码行数:62,代码来源:LLUDPServer.cs
示例8: GetRate
public int GetRate(ThrottleOutPacketType type)
{
switch (type)
{
case ThrottleOutPacketType.Resend:
return Resend;
case ThrottleOutPacketType.Land:
return Land;
case ThrottleOutPacketType.Wind:
return Wind;
case ThrottleOutPacketType.Cloud:
return Cloud;
case ThrottleOutPacketType.Task:
return Task;
case ThrottleOutPacketType.Texture:
return Texture;
case ThrottleOutPacketType.Asset:
return Asset;
case ThrottleOutPacketType.Unknown:
default:
return 0;
}
}
开发者ID:RadaSangOn,项目名称:workCore2,代码行数:23,代码来源:ThrottleRates.cs
示例9: BroadcastPacket
public void BroadcastPacket(Packet packet, ThrottleOutPacketType category, bool sendToPausedAgents,
bool allowSplitting, UnackedPacketMethod resendMethod,
UnackedPacketMethod finishedMethod)
{
// CoarseLocationUpdate and AvatarGroupsReply packets cannot be split in an automated way
if ((packet.Type == PacketType.CoarseLocationUpdate || packet.Type == PacketType.AvatarGroupsReply) &&
allowSplitting)
allowSplitting = false;
if (allowSplitting && packet.HasVariableBlocks)
{
byte[][] datas = packet.ToBytesMultiple();
int packetCount = datas.Length;
if (packetCount < 1)
MainConsole.Instance.Error("[LLUDP Server]: Failed to split " + packet.Type +
" with estimated length " + packet.Length);
for (int i = 0; i < packetCount; i++)
{
byte[] data = datas[i];
ForEachInternalClient(
delegate(IClientAPI client)
{
if (client is LLClientView)
SendPacketData(((LLClientView) client).UDPClient, data, packet, category,
resendMethod, finishedMethod);
}
);
}
}
else
{
byte[] data = packet.ToBytes();
ForEachInternalClient(
delegate(IClientAPI client)
{
if (client is LLClientView)
SendPacketData(((LLClientView) client).UDPClient, data, packet, category, resendMethod,
finishedMethod);
}
);
}
}
开发者ID:VirtualReality,项目名称:Universe,代码行数:44,代码来源:LLUDPServer.cs
示例10: SendPacket
public void SendPacket(LLUDPClient udpClient, Packet packet, ThrottleOutPacketType category, bool allowSplitting)
{
// CoarseLocationUpdate packets cannot be split in an automated way
if (packet.Type == PacketType.CoarseLocationUpdate && allowSplitting)
allowSplitting = false;
if (allowSplitting && packet.HasVariableBlocks)
{
byte[][] datas;
int[] sizes;
if (packet.UsesBufferPooling)
{
datas = packet.ToBytesMultiple(_bufferPool, out sizes);
}
else
{
datas = packet.ToBytesMultiple();
sizes = new int[datas.Length];
for (int i = 0; i < datas.Length; i++)
{
sizes[i] = datas[i].Length;
}
}
//add up all the sizes of the data going out for this packet. if it is more than MAX_PACKET_SIZE
//drop it and log it
long totalSz = 0;
foreach (int size in sizes)
{
totalSz += size;
}
if (totalSz > MAX_PACKET_SIZE)
{
m_log.ErrorFormat("[LLUDPSERVER] Not sending HUGE packet Type:{0}, Size: {1}", packet.Type, totalSz);
datas = null;
return;
}
int packetCount = datas.Length;
if (packetCount < 1)
m_log.Error("[LLUDPSERVER]: Failed to split " + packet.Type + " with estimated length " + packet.Length);
for (int i = 0; i < packetCount; i++)
{
byte[] data = datas[i];
SendPacketData(udpClient, data, sizes[i], packet.Type, category, packet.UsesBufferPooling);
}
}
else
{
byte[] data;
int size = 0;
if (packet.UsesBufferPooling)
{
data = packet.ToBytes(_bufferPool, ref size);
}
else
{
data = packet.ToBytes();
size = data.Length;
}
if (size > MAX_PACKET_SIZE)
{
m_log.ErrorFormat("[LLUDPSERVER] Not sending HUGE packet Type:{0}, Size: {1}", packet.Type, size);
data = null;
return;
}
SendPacketData(udpClient, data, size, packet.Type, category, packet.UsesBufferPooling);
}
}
开发者ID:digitalmystic,项目名称:halcyon,代码行数:77,代码来源:LLUDPServer.cs
示例11: SendPacketData
public void SendPacketData(LLUDPClient udpClient, byte[] data, int dataLength, PacketType type,
ThrottleOutPacketType category, bool bufferAcquiredFromPool)
{
bool doZerocode = (data[0] & Helpers.MSG_ZEROCODED) != 0;
bool zeroCoded = false;
byte[] outBuffer = null;
// Zerocode if needed
if (doZerocode)
{
// Frequency analysis of outgoing packet sizes shows a large clump of packets at each end of the spectrum.
// The vast majority of packets are less than 200 bytes, although due to asset transfers and packet splitting
// there are a decent number of packets in the 1000-1140 byte range. We allocate one of two sizes of data here
// to accomodate for both common scenarios and provide ample room for ACK appending in both
int bufferSize = (dataLength > 180) ? LLUDPServer.MTU : 200;
try
{
//zerocode and return the current buffer to the pool if necessary
outBuffer = _bufferPool.LeaseBytes(bufferSize);
dataLength = Helpers.ZeroEncode(data, dataLength, outBuffer);
zeroCoded = true;
if (bufferAcquiredFromPool)
{
_bufferPool.ReturnBytes(data);
}
//now the buffer is from a pool most definitely
bufferAcquiredFromPool = true;
}
catch (IndexOutOfRangeException)
{
//TODO: Throwing an exception here needs to be revisted. I've seen an issue with
//70+ avatars where a very common high freq packet hits this code everytime
//that packet either needs to be split, or this needs to be revised to not throw
//and instead check the buffer size and return an error condition
// The packet grew larger than the bufferSize while zerocoding.
// Remove the MSG_ZEROCODED flag and send the unencoded data
// instead
m_log.Debug("[LLUDPSERVER]: Packet exceeded buffer size during zerocoding for " + type + ". DataLength=" + dataLength +
" and BufferLength=" + outBuffer.Length + ". Removing MSG_ZEROCODED flag");
data[0] = (byte)(data[0] & ~Helpers.MSG_ZEROCODED);
_bufferPool.ReturnBytes(outBuffer);
}
}
if (! zeroCoded)
{
outBuffer = data;
}
#region Queue or Send
OutgoingPacket outgoingPacket = new OutgoingPacket(udpClient, outBuffer, (int)category, dataLength,
udpClient.RemoteEndPoint, bufferAcquiredFromPool, type);
if (!udpClient.EnqueueOutgoing(outgoingPacket))
SendPacketFinal(outgoingPacket);
#endregion Queue or Send
}
开发者ID:digitalmystic,项目名称:halcyon,代码行数:64,代码来源:LLUDPServer.cs
示例12: QueuePacket
private void QueuePacket(
Packet packet, ThrottleOutPacketType throttlePacketType,
Object id)
{
LLQueItem item = new LLQueItem();
item.Packet = packet;
item.Incoming = false;
item.throttleType = throttlePacketType;
item.TickCount = Environment.TickCount;
item.Identifier = id;
item.Resends = 0;
item.Length = packet.Length;
item.Sequence = packet.Header.Sequence;
m_PacketQueue.Enqueue(item);
m_PacketsSent++;
}
开发者ID:ChrisD,项目名称:opensim,代码行数:17,代码来源:LLPacketHandler.cs
示例13: OutPacket
public void OutPacket(
Packet packet, ThrottleOutPacketType throttlePacketType,
Object id)
{
// Call the load balancer's hook. If this is not active here
// we defer to the sim server this client is actually connected
// to. Packet drop notifies will not be triggered in this
// configuration!
//
packet.Header.Sequence = 0;
lock (m_NeedAck)
{
DropResend(id);
AddAcks(ref packet);
QueuePacket(packet, throttlePacketType, id);
}
}
开发者ID:ChrisD,项目名称:opensim,代码行数:20,代码来源:LLPacketHandler.cs
示例14: GetLimit
public int GetLimit(ThrottleOutPacketType type)
{
switch (type)
{
case ThrottleOutPacketType.Resend:
return ResendLimit;
case ThrottleOutPacketType.Land:
return LandLimit;
case ThrottleOutPacketType.Wind:
return WindLimit;
case ThrottleOutPacketType.Cloud:
return CloudLimit;
case ThrottleOutPacketType.Task:
return TaskLimit;
case ThrottleOutPacketType.Texture:
return TextureLimit;
case ThrottleOutPacketType.Asset:
return AssetLimit;
case ThrottleOutPacketType.State:
return StateLimit;
case ThrottleOutPacketType.Unknown:
default:
return 0;
}
}
开发者ID:kf6kjg,项目名称:halcyon,代码行数:25,代码来源:ThrottleRates.cs
示例15: GetCatRateMS
public int GetCatRateMS(ThrottleOutPacketType cat)
{
TokenBucket bucket = m_throttleCategories[(int)cat];
int ratems = (int)(bucket.RequestedDripRate/1000);
if (ratems <1 ) ratems=1;
return ratems;
}
开发者ID:UbitUmarov,项目名称:Ubit-opensim,代码行数:7,代码来源:LLUDPClient.cs
示例16: OutgoingPacket
/// <summary>
/// Default constructor
/// </summary>
/// <param name="client">Reference to the client this packet is destined for</param>
/// <param name="buffer">Serialized packet data. If the flags or sequence number
/// need to be updated, they will be injected directly into this binary buffer</param>
/// <param name="category">Throttling category for this packet</param>
public OutgoingPacket(LLUDPClient client, UDPPacketBuffer buffer, ThrottleOutPacketType category)
{
Client = client;
Buffer = buffer;
Category = category;
}
开发者ID:AlphaStaxLLC,项目名称:taiga,代码行数:13,代码来源:OutgoingPacket.cs
示例17: GetPacketsQueuedCount
/// <summary>
/// Get the number of packets queued for the given throttle type.
/// </summary>
/// <returns></returns>
/// <param name="throttleType"></param>
public int GetPacketsQueuedCount(ThrottleOutPacketType throttleType)
{
if ((int)throttleType > 0)
return m_packetOutboxes[(int)throttleType].Count;
else
return 0;
}
开发者ID:szielins,项目名称:opensim,代码行数:12,代码来源:LLUDPClient.cs
示例18: BroadcastPacket
public void BroadcastPacket(Packet packet, ThrottleOutPacketType category, bool sendToPausedAgents, bool allowSplitting)
{
// CoarseLocationUpdate packets cannot be split in an automated way
if (packet.Type == PacketType.CoarseLocationUpdate && allowSplitting)
allowSplitting = false;
if (allowSplitting && packet.HasVariableBlocks)
{
byte[][] datas = packet.ToBytesMultiple();
int packetCount = datas.Length;
//if (packetCount > 1)
// m_log.Debug("[LLUDPSERVER]: Split " + packet.Type + " packet into " + packetCount + " packets");
for (int i = 0; i < packetCount; i++)
{
byte[] data = datas[i];
m_scene.ForEachClient(
delegate(IClientAPI client)
{
if (client is LLClientView)
SendPacketData(((LLClientView)client).UDPClient, data, packet.Type, category);
}
);
}
}
else
{
byte[] data = packet.ToBytes();
m_scene.ForEachClient(
delegate(IClientAPI client)
{
if (client is LLClientView)
SendPacketData(((LLClientView)client).UDPClient, data, packet.Type, category);
}
);
}
}
开发者ID:intari,项目名称:OpenSimMirror,代码行数:38,代码来源:LLUDPServer.cs
示例19: BroadcastPacket
public void BroadcastPacket(Packet packet, ThrottleOutPacketType category, bool sendToPausedAgents, bool allowSplitting)
{
// CoarseLocationUpdate and AvatarGroupsReply packets cannot be split in an automated way
if ((packet.Type == PacketType.CoarseLocationUpdate || packet.Type == PacketType.AvatarGroupsReply) && allowSplitting)
allowSplitting = false;
if (allowSplitting && packet.HasVariableBlocks)
{
byte[][] datas = packet.ToBytesMultiple();
int packetCount = datas.Length;
if (packetCount < 1)
m_log.Error("[LLUDPSERVER]: Failed to split " + packet.Type + " with estimated length " + packet.Length);
for (int i = 0; i < packetCount; i++)
{
byte[] data = datas[i];
m_scene.ForEachClient(
delegate(IClientAPI client)
{
if (client is LLClientView)
SendPacketData(((LLClientView)client).UDPClient, data, packet.Type, category, null);
}
);
}
}
else
{
byte[] data = packet.ToBytes();
m_scene.ForEachClient(
delegate(IClientAPI client)
{
if (client is LLClientView)
SendPacketData(((LLClientView)client).UDPClient, data, packet.Type, category, null);
}
);
}
}
开发者ID:JeffCost,项目名称:opensim,代码行数:38,代码来源:LLUDPServer.cs
示例20: SendPacket
public void SendPacket(LLUDPClient udpClient, Packet packet, ThrottleOutPacketType category, bool allowSplitting)
{
// CoarseLocationUpdate packets cannot be split in an automated way
if (packet.Type == PacketType.CoarseLocationUpdate && allowSplitting)
allowSplitting = false;
if (allowSplitting && packet.HasVariableBlocks)
{
byte[][] datas = packet.ToBytesMultiple();
int packetCount = datas.Length;
//if (packetCount > 1)
// m_log.Debug("[LLUDPSERVER]: Split " + packet.Type + " packet into " + packetCount + " packets");
for (int i = 0; i < packetCount; i++)
{
byte[] data = datas[i];
SendPacketData(udpClient, data, packet.Type, category);
}
}
else
{
byte[] data = packet.ToBytes();
SendPacketData(udpClient, data, packet.Type, category);
}
}
开发者ID:intari,项目名称:OpenSimMirror,代码行数:26,代码来源:LLUDPServer.cs
注:本文中的ThrottleOutPacketType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论