예제 #1
0
        public void Release()
        {
            Connection c = this;

            refIds.releaseId(c.id);
            refConnections.TryRemove(id, out c);
            socket.Close();
            socket.Dispose();
        }
예제 #2
0
        public void Release()
        {
            timeoutTimer.Close();
            timeoutTimer.Dispose();

            Connection c = this;

            refIds.releaseId(c.id);
            refConnections.TryRemove(id, out c);
        }
예제 #3
0
        public void removeEntity(ref Connection c, ref ConcurrentDictionary <int, Connection> connections, int id)
        {
            Entity e;

            entities.TryRemove(id, out e);
            entityIdMap.releaseId(id);
            Buffer buffer = new Buffer();

            foreach (Connection client in connections.Values)
            {
                if (client != null)
                {
                    buffer.SeekStart();
                    buffer.WriteInt8(8);
                    buffer.WriteInt16((short)id);
                    client.socket.Send(buffer.GetBytes(), 0, buffer.Tell(), 0);
                }
            }
            buffer.Clear();
        }