Example #1
0
        public void Dispose()
        {
            if (Pointer == IntPtr.Zero)
            {
                return;
            }

            try { StopServiceThread(); } catch { }

            if (Compressor != null)
            {
                Compressor.Dispose();
                Compressor = null;
            }

            if (Checksum != null)
            {
                Checksum.Dispose();
                Checksum = null;
            }

            if (Interceptor != null)
            {
                Interceptor.Dispose();
                Interceptor = null;
            }

            m_Peers.ForEach(p => p.FreeHandle());
            LibENet.HostDestroy(Pointer);
            Pointer = IntPtr.Zero;
        }
Example #2
0
        public void ChecksumWithCRC32()
        {
            CheckDispose();

            if (Checksum != null)
            {
                Checksum.Dispose();
                Checksum = null;
            }

            *m_pChecksumCallback = LibENet.GetProc("enet_crc32");
        }
Example #3
0
        public void DoNotChecksum()
        {
            CheckDispose();

            if (Checksum != null)
            {
                Checksum.Dispose();
                Checksum = null;
            }

            *m_pChecksumCallback = IntPtr.Zero;
        }
Example #4
0
        public void ChecksumWith(ENetChecksum checksum)
        {
            CheckDispose();

            if (checksum.Host != null && checksum.Host != this)
            {
                throw new Exception("Checksum is already in-use by another host.");
            }

            if (Checksum != null)
            {
                Checksum.Dispose();
                Checksum = null;
            }

            Checksum = checksum;
            *m_pChecksumCallback = Marshal.GetFunctionPointerForDelegate(ChecksumDelegate);
        }