当前位置: 首页>>代码示例>>C#>>正文


C# NetOutgoingMessage.Reset方法代码示例

本文整理汇总了C#中Lidgren.Network.NetOutgoingMessage.Reset方法的典型用法代码示例。如果您正苦于以下问题:C# NetOutgoingMessage.Reset方法的具体用法?C# NetOutgoingMessage.Reset怎么用?C# NetOutgoingMessage.Reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Lidgren.Network.NetOutgoingMessage的用法示例。


在下文中一共展示了NetOutgoingMessage.Reset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Recycle

        internal void Recycle(NetOutgoingMessage msg)
        {
            if (m_outgoingMessagesPool == null)
                return;
            #if DEBUG
            if (m_outgoingMessagesPool.Contains(msg))
                throw new NetException("Recyling already recycled message! Thread race?");
            #endif

            byte[] storage = msg.m_data;
            msg.m_data = null;

            // message fragments cannot be recycled
            // TODO: find a way to recycle large message after all fragments has been acknowledged; or? possibly better just to garbage collect them
            if (msg.m_fragmentGroup == 0)
                Recycle(storage);

            msg.Reset();
            m_outgoingMessagesPool.Enqueue(msg);
        }
开发者ID:tomoprime,项目名称:CrabBattle,代码行数:20,代码来源:NetPeer.MessagePools.cs

示例2: Recycle

		internal void Recycle(NetOutgoingMessage msg)
		{
			if (m_outgoingMessagesPool == null)
				return;
#if DEBUG
			NetException.Assert(m_outgoingMessagesPool.Contains(msg) == false, "Recyling already recycled outgoing message! Thread race?");
			if (msg.m_recyclingCount != 0)
				LogWarning("Wrong recycling count! should be zero; found " + msg.m_recyclingCount);
#endif
			// setting m_recyclingCount to zero SHOULD be an unnecessary maneuver, if it's not zero something is wrong
			// however, in RELEASE, we'll just have to accept this and move on with life
			msg.m_recyclingCount = 0;

			byte[] storage = msg.m_data;
			msg.m_data = null;

			// message fragments cannot be recycled
			// TODO: find a way to recycle large message after all fragments has been acknowledged; or? possibly better just to garbage collect them
			if (msg.m_fragmentGroup == 0)
				Recycle(storage);

			msg.Reset();
			if (m_outgoingMessagesPool.Count < m_maxCacheCount)
				m_outgoingMessagesPool.Enqueue(msg);
		}
开发者ID:xxy1991,项目名称:cozy,代码行数:25,代码来源:NetPeer.MessagePools.cs


注:本文中的Lidgren.Network.NetOutgoingMessage.Reset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。