Esempio n. 1
0
 private void PerformGarbageDataNotification(TrafficTrackingRec tracking, EndPoint rcep, byte[] buffer, int offset, int bytesTransferred)
 {
     byte[] copy = new byte[bytesTransferred];
     Array.Copy(buffer, copy, bytesTransferred);
     tracking.Strategy = PerformGarbageArrival(rcep, tracking.IncrementGarbageCount(), copy);
 }
Esempio n. 2
0
        private void HandleGarbageData(EndPoint ep, byte[] buffer, int offset, int bytesTransferred)
        {
            this.TraceData(TraceEventType.Verbose, () =>
                {
                    return new object[] { ((IPEndPoint)ep).ToString(), Util.BytesToOctets(buffer, offset, bytesTransferred) };
                });

            if (_garbageHandling > ListenerGarbageHandling.FailSilently)
            {
                IPEndPoint ipep = (IPEndPoint)ep;
                TrafficTrackingKey key = new TrafficTrackingKey(ep);
                TrafficTrackingRec tracking;
                lock (_garbageTrackingLock)
                {
                    if (!_garbageTracking.TryGetValue(key, out tracking))
                    {
                        tracking = new TrafficTrackingRec(ep);
                        _garbageTracking.Add(key, tracking);
                    }
                }
                if (_garbageHandling == ListenerGarbageHandling.AskEventSinksToVoteOnStrategy
                    && tracking.Strategy != GarbageHandlingVote.IgnoreAllTrafficFromEndpoint)
                {
                    PerformGarbageDataNotification(tracking, ep, buffer, offset, bytesTransferred);
                }
            }
        }