コード例 #1
0
        // Token: 0x06000134 RID: 308 RVA: 0x00006C24 File Offset: 0x00004E24
        public IAsyncResult BeginCommand(ImapCommand command, bool processResponse, ImapConnectionContext imapConnectionContext, AsyncCallback callback, object callbackState)
        {
            base.CheckDisposed();
            byte[] array = command.ToBytes();
            this.currentResponse.Reset(command);
            this.currentCommand = command;
            AsyncResult <ImapConnectionContext, ImapResultData> asyncResult = new AsyncResult <ImapConnectionContext, ImapResultData>(this, imapConnectionContext, callback, callbackState);

            asyncResult.State.TimeSent = ExDateTime.MinValue;
            if (this.cancellationRequested)
            {
                asyncResult.SetCompletedSynchronously();
                this.HandleCancellation(asyncResult);
                return(asyncResult);
            }
            if (this.isNetworkConnectionShutdown)
            {
                asyncResult.SetCompletedSynchronously();
                ImapNetworkFacade.HandleError(ImapNetworkFacade.GetConnectionClosedException(), asyncResult);
                return(asyncResult);
            }
            this.totalBytesSent += (long)array.Length;
            if (this.totalBytesSent > this.connectionParameters.MaxBytesToTransfer)
            {
                asyncResult.SetCompletedSynchronously();
                ImapNetworkFacade.HandleError(ImapNetworkFacade.MaxBytesSentExceeded(), asyncResult);
                return(asyncResult);
            }
            if (processResponse && this.totalBytesReceived > this.connectionParameters.MaxBytesToTransfer)
            {
                asyncResult.State.Log.Debug("Not sending {0}, since we've exceeded our received-bytes threshold.", new object[]
                {
                    this.currentCommand.ToPiiCleanString()
                });
                asyncResult.SetCompletedSynchronously();
                ImapNetworkFacade.HandleError(ImapNetworkFacade.MaxBytesReceivedExceeded(), asyncResult);
                return(asyncResult);
            }
            asyncResult.State.Log.Info("IMAP Send command: [{0}]", new object[]
            {
                this.currentCommand.ToPiiCleanString()
            });
            DownloadCompleteEventArgs eventArgs = new DownloadCompleteEventArgs(0L, (long)array.Length);

            imapConnectionContext.ActivatePerfDownloadEvent(imapConnectionContext, eventArgs);
            if (processResponse)
            {
                asyncResult.PendingAsyncResult = this.networkConnection.BeginWrite(array, 0, array.Length, new AsyncCallback(this.OnEndWriteCommandOrLiteralBeginReadResponse), asyncResult);
            }
            else
            {
                asyncResult.PendingAsyncResult = this.networkConnection.BeginWrite(array, 0, array.Length, new AsyncCallback(this.OnEndSendCommandIgnoreResponse), asyncResult);
                asyncResult.SetCompletedSynchronously();
                this.currentResultData.Clear();
                asyncResult.ProcessCompleted(this.currentResultData);
            }
            return(asyncResult);
        }
コード例 #2
0
        internal static void LogExceptionDetails(ILog log, ImapCommand failingCommand, Exception failure)
        {
            Exception ex = failure;

            while (ex.InnerException != null)
            {
                ex = ex.InnerException;
            }
            log.Error("While executing [{0}]: {1}", new object[]
            {
                failingCommand.ToPiiCleanString(),
                ex.Message
            });
            string stackTrace = ex.StackTrace;

            if (stackTrace != null && stackTrace.Length > 0)
            {
                log.Error("Stack [{0}]", new object[]
                {
                    stackTrace
                });
            }
        }
コード例 #3
0
 // Token: 0x06000150 RID: 336 RVA: 0x00008096 File Offset: 0x00006296
 private void LogFailureDetails(ImapCommand command, ImapResponse response)
 {
     this.LogFailureDetails(command.ToPiiCleanString(), response);
 }
コード例 #4
0
 // Token: 0x06000133 RID: 307 RVA: 0x00006C14 File Offset: 0x00004E14
 public IAsyncResult BeginCommand(ImapCommand command, ImapConnectionContext imapConnectionContext, AsyncCallback callback, object callbackState)
 {
     return(this.BeginCommand(command, true, imapConnectionContext, callback, callbackState));
 }