Пример #1
0
        public static ReliableMessageReceiveTracking Create()
        {
            ReliableMessageReceiveTracking rmrt = Recycler <ReliableMessageReceiveTracking> .GetObject();

            rmrt.receivePartsLength = 0;
            rmrt.receivePartsLeft   = 0;
            rmrt.networkMessage     = null;
            return(rmrt);
        }
        public static ReliableMessageSendTracking <T> Create()
        {
            ReliableMessageSendTracking <T> rmst = Recycler <ReliableMessageSendTracking <T> > .GetObject();

            rmst.sendPartsLength = 0;
            rmst.sendPartsLeft   = 0;
            rmst.nextSendPart    = 0;
            rmst.finished        = false;
            return(rmst);
        }
Пример #3
0
        public static NetworkMessage Create(int type, int size, NetworkMessageType sendType)
        {
            NetworkMessage retVal = Recycler <NetworkMessage> .GetObject();

            retVal.type     = type;
            retVal.sendType = sendType;
            retVal.data     = null;
            if (size > 0)
            {
                retVal.data = ByteRecycler.GetObject(size);
            }
            retVal.usageCount = 1;
            return(retVal);
        }
Пример #4
0
        public void SendRawHighPriority(NetworkMessage networkMessage, Connection <T> connection)
        {
            lock (sendHighPriorityMessages)
            {
                QueuedMessage <T> qm = Recycler <QueuedMessage <T> > .GetObject();

                qm.networkMessage = networkMessage;
                qm.connection     = connection;
                sendHighPriorityMessages.Enqueue(qm);
                if (networkMessage.data != null)
                {
                    connection.queuedOut += networkMessage.data.Length;
                }
                sendEvent.Set();
            }
        }
Пример #5
0
        public void Handle(NetworkMessage nm, Connection <T> connection)
        {
            if (useMessagePump && nm.type >= 0)
            {
                lock (messages)
                {
                    QueuedMessage <T> qm = Recycler <QueuedMessage <T> > .GetObject();

                    qm.networkMessage = nm;
                    qm.connection     = connection;
                    messages.Add(qm);
                }
            }
            else
            {
                HandleReal(nm, connection);
            }
        }