Example #1
0
        static void FreeCallbackHandler(Native.ENetPacket *native)
        {
            Packet packet = new Packet(native);

            lock (_userData)
            {
                try
                {
                    PacketFreeCallback callback = (PacketFreeCallback)packet.GetUserData(_freeCallbackKey);

                    if (callback != null)
                    {
                        try
                        {
                            Monitor.Exit(_userData);
                            callback(packet);
                        }
                        finally
                        {
                            Monitor.Enter(_userData);
                        }
                    }
                }
                finally
                {
                    _userData.Remove(packet);
                }
            }
        }
Example #2
0
        static void FreeCallbackHandler(Native.ENetPacket *native)
        {
            Packet packet = new Packet(native);

            try
            {
                PacketFreeCallback callback = (PacketFreeCallback)packet.GetUserData(_freeCallbackKey);

                if (callback != null)
                {
                    callback(packet);
                }
            }
            finally
            {
                _userData.Remove(packet);
            }
        }