Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        private MantaSmtpClientPoolCollection()
        {
            MantaCoreEvents.RegisterStopRequiredInstance(this);

            ClientPools = new Dictionary <string, MantaOutboundClientPool>();
            Task.Factory.StartNew(async() =>
            {
                do
                {
                    await Task.Delay(1000);
                    foreach (var k in ClientPools.Keys)
                    {
                        if (IsStopping)
                        {
                            break;
                        }

                        if (ClientPools[k].LastUsedTimestamp < DateTime.UtcNow.AddMinutes(-2).Ticks)
                        {
                            ClientPools.Remove(k);
                        }
                    }
                } while (!IsStopping);
            }, TaskCreationOptions.LongRunning);
        }
Exemplo n.º 2
0
        private EventsFileHandler()
        {
            // EventsFileHandler needs to be stopped when MantaMTA is stopping.
            MantaCoreEvents.RegisterStopRequiredInstance(this);

            // Make sure the drop folders exist.
            Directory.CreateDirectory(MtaParameters.BounceDropFolder);
            Directory.CreateDirectory(Path.Combine(MtaParameters.BounceDropFolder, _SubdirectoryForProblemEmails));
            Directory.CreateDirectory(MtaParameters.FeedbackLoopDropFolder);
            Directory.CreateDirectory(Path.Combine(MtaParameters.FeedbackLoopDropFolder, _SubdirectoryForProblemEmails));

            // Setup and start the bounce email file watcher.
            FileSystemWatcher bounceWatcher = new FileSystemWatcher(MtaParameters.BounceDropFolder, "*.eml");

            bounceWatcher.Created            += DoBounceFileProcessing;
            bounceWatcher.EnableRaisingEvents = true;

            // Setup and start the feedback loop email file watcher.
            FileSystemWatcher abuseWatcher = new FileSystemWatcher(MtaParameters.FeedbackLoopDropFolder, "*.eml");

            abuseWatcher.Created            += DoAbuseFileProcessing;
            abuseWatcher.EnableRaisingEvents = true;

            Thread t = new Thread(new ThreadStart(delegate()
            {
                DoBounceFileProcessing(bounceWatcher, new FileSystemEventArgs(WatcherChangeTypes.All, MtaParameters.BounceDropFolder, string.Empty));
                DoAbuseFileProcessing(abuseWatcher, new FileSystemEventArgs(WatcherChangeTypes.All, MtaParameters.FeedbackLoopDropFolder, string.Empty));
            }));

            t.Start();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Call this method to start the EventHttpForwarder.
        /// </summary>
        public void Start()
        {
            MantaCoreEvents.RegisterStopRequiredInstance(this);
            Thread t = new Thread(new ThreadStart(ForwardEvents));

            t.IsBackground = true;
            t.Start();
        }
Exemplo n.º 4
0
 private MessageSender()
 {
     MantaCoreEvents.RegisterStopRequiredInstance(this);
 }
Exemplo n.º 5
0
 private RabbitMqInboundStagingHandler()
 {
     MantaCoreEvents.RegisterStopRequiredInstance(this);
 }