Beispiel #1
0
        public static void ReportError(Exception exception, NetPeer peer = null)
        {
            if (LogExceptions)
            {
                if (peer != null)
                {
                    LogError(exception: new Exception("NetException from " + peer.EndPoint + ": ", exception));
                }
                else
                {
                    LogError(exception: new Exception("NetException: ", exception));
                }
            }
            if (InstanceType != NetInstanceType.Server || peer == null)
            {
                return;
            }

            PeerRecord record = peerRecords[peer];

            record.TotalErrors++;
            record.KickThreshold += 1.0f / KickExceptionThreshold;

            if (KickPeers && record.KickThreshold >= 1.0f)
            {
                Kick(peer, "Exception threshold reached.");
            }
        }
Beispiel #2
0
        public static void ReportWarning(Exception exception, NetPeer peer = null)
        {
            if (LogExceptions)
            {
                if (peer != null)
                {
                    LogWarning(exception: new Exception("NetException from " + peer.EndPoint + ": ", exception));
                }
                else
                {
                    LogWarning(exception: new Exception("NetException: ", exception));
                }
            }
            if (InstanceType != NetInstanceType.Server || peer == null)
            {
                return;
            }

            PeerRecord record = peerRecords[peer];

            record.TotalWarnings++;
        }