internal SubmissionConnection(string key, SubmissionConnectionPool pool, string server, string database)
 {
     this.key      = key;
     this.pool     = pool;
     this.server   = server;
     this.database = database;
     this.id       = SessionId.GetNextSessionId();
     TraceHelper.SubmissionConnectionTracer.TracePass <int, string>(TraceHelper.MessageProbeActivityId, (long)this.GetHashCode(), "SubmissionConnection.ctor: Thread {0}, Created: {1}.", Thread.CurrentThread.ManagedThreadId, this.ToString());
 }
Пример #2
0
        public SmtpResponse DoLocalDelivery(TransportMailItem item)
        {
            ulong num  = 0UL;
            ulong num2 = 0UL;
            ulong num3 = 0UL;
            MbxTransportMailItem mbxTransportMailItem = null;
            string sourceContext = string.Empty;

            if (StoreDriverDelivery.SilentlyDropProbeMessages(item))
            {
                return(SmtpResponse.ProbeMessageDropped);
            }
            try
            {
                item.CacheTransportSettings();
                ExTraceGlobals.FaultInjectionTracer.TraceTest(2735091005U);
                num3 = SessionId.GetNextSessionId();
                mbxTransportMailItem = new MbxTransportMailItem(item);
                mbxTransportMailItem.SessionStartTime = DateTime.UtcNow;
                sourceContext = StoreDriverDelivery.GenerateSessionSourceContext(num3, mbxTransportMailItem.SessionStartTime);
                StoreDriverDelivery.SetupLatencyTracker(mbxTransportMailItem);
                StoreDriverDelivery.ResolveItemRecipients(item);
                if (!this.ResolveMdbParameters(mbxTransportMailItem, num3))
                {
                    return(mbxTransportMailItem.Response);
                }
                StoreDriverDelivery.ScopeADRecipientCache(item);
                ConnectionLog.MapiDeliveryConnectionStart(num3, mbxTransportMailItem.DatabaseName, string.Format("Delivery;MailboxServer={0};Database={1}", StoreDriverDelivery.MailboxServerFqdn, mbxTransportMailItem.DatabaseName));
                if (this.retired)
                {
                    ConnectionLog.MapiDeliveryConnectionRetired(num3, mbxTransportMailItem.DatabaseName);
                    return(SmtpResponseGenerator.StoreDriverRetireResponse);
                }
                MSExchangeStoreDriver.MessageDeliveryAttempts.Increment();
                MSExchangeStoreDriver.CurrentDeliveryThreads.Increment();
                StoreDriverDeliveryDiagnostics.IncrementDeliveringThreads();
                StoreDriverDeliveryDiagnostics.Diag.TracePfd <int, string>(0L, "PFD ESD {0} Start local delivery to {1}", 21403, mbxTransportMailItem.DatabaseName);
                ConnectionLog.MapiDeliveryConnectionStartingDelivery(num3, mbxTransportMailItem.DatabaseName);
                int num4 = this.DeliverMailItem(mbxTransportMailItem, num3);
                if (0 < num4)
                {
                    num  += (ulong)mbxTransportMailItem.MimeSize;
                    num2 += (ulong)((long)num4);
                }
                ConnectionLog.MapiDeliveryConnectionStop(num3, mbxTransportMailItem.DatabaseName, 1UL, num, num2);
            }
            catch (ADTransientException exception)
            {
                if (mbxTransportMailItem == null)
                {
                    mbxTransportMailItem = new MbxTransportMailItem(item);
                }
                RetryException exception2 = new RetryException(new MessageStatus(MessageAction.Retry, AckReason.RecipientMailboxLocationInfoNotAvailable, exception));
                StoreDriverDelivery.AckMailItemOnRetryException(AckStatus.Retry, mbxTransportMailItem, exception2, sourceContext, num3, num, num2);
                ExTraceGlobals.FaultInjectionTracer.TraceTest(48992U);
            }
            catch (RetryException exception3)
            {
                StoreDriverDelivery.AckMailItemOnRetryException(AckStatus.Retry, mbxTransportMailItem, exception3, sourceContext, num3, num, num2);
            }
            finally
            {
                StoreDriverDeliveryDiagnostics.DecrementDeliveringThreads();
                MSExchangeStoreDriver.CurrentDeliveryThreads.Decrement();
                StoreDriverDeliveryDiagnostics.Diag.TracePfd <int, string>(0L, "PFD ESD {0} Stop local delivery to {1}", 17563, mbxTransportMailItem.DatabaseName);
                StoreDriverDeliveryDiagnostics.TroubleshootingContext.TraceOperationCompletedAndUpdateContext();
            }
            return(mbxTransportMailItem.Response);
        }