Exemple #1
0
        /// <summary>
        /// Used to clean up the target composer from memory
        /// </summary>
        /// <param name="composer">The composer that has completed</param>
        protected void ComposerCompleted(SteamP2PPacketComposer composer)
        {
#if DEEP_LOGGING
            Logging.BMSLog.Log($"<<<<<<<<<<<<<<<<<<<<<<<<<<< CONFIRMING: {composer.Frame.UniqueId}");
#endif

            lock (pendingComposers)
            {
                pendingComposers.Remove(composer);
            }
        }
Exemple #2
0
        public void Send(NetworkingPlayer player, FrameStream frame, bool reliable = false)
        {
            SteamP2PPacketComposer composer = new SteamP2PPacketComposer(this, player, frame, reliable);

            // If this message is reliable then make sure to keep a reference to the composer
            // so that there are not any run-away threads
            if (reliable)
            {
                lock (pendingComposers)
                {
                    // Use the completed event to clean up the object from memory
                    composer.completed += ComposerCompleted;
                    pendingComposers.Add(composer);
                }
            }
        }
Exemple #3
0
        public override void Send(FrameStream frame, bool reliable = false)
        {
            SteamP2PPacketComposer composer = new SteamP2PPacketComposer(this, Server, frame, reliable);

            // If this message is reliable then make sure to keep a reference to the composer
            // so that there are not any run-away threads
            if (reliable)
            {
                // Use the completed event to clean up the object from memory
                composer.completed += ComposerCompleted;
                pendingComposers.Add(composer);
            }

            //TODO: New constructor for setting up callbacks before regular constructor (as seen above)
            //composer.Init(this, Server, frame, reliable);
        }
Exemple #4
0
        public override void Send(FrameStream frame, bool reliable = false)
        {
            /*//might have to go back to UDP packet composers. needs testing
             * byte[] data = frame.GetData(reliable);
             *
             * Client.Send(data, data.Length, Server.SteamID, reliable ? EP2PSend.k_EP2PSendReliable : EP2PSend.k_EP2PSendUnreliable);*/

            SteamP2PPacketComposer composer = new SteamP2PPacketComposer(this, Server, frame, reliable);

            // If this message is reliable then make sure to keep a reference to the composer
            // so that there are not any run-away threads
            if (reliable)
            {
                // Use the completed event to clean up the object from memory
                composer.completed += ComposerCompleted;
                pendingComposers.Add(composer);
            }

            //TODO: New constructor for setting up callbacks before regular constructor (as seen above)
            //composer.Init(this, Server, frame, reliable);
        }