示例#1
0
 // Token: 0x060000F9 RID: 249 RVA: 0x0000762C File Offset: 0x0000582C
 public void CloseSession(LogSession session)
 {
     ExTraceGlobals.ServiceTracer.TraceDebug((long)this.GetHashCode(), "MsExchangeLogSearch LogSessionManager CloseSession");
     lock (this.sessionLock)
     {
         if (this.stopping)
         {
             return;
         }
         this.sessions.Remove(session.Id);
     }
     session.BeginClose();
     session.EndClose();
 }
 // Token: 0x06000106 RID: 262 RVA: 0x00007E4C File Offset: 0x0000604C
 public override byte[] Continue(Guid sessionId, bool continueInBackground, int resultLimit, ref int resultSize, ref bool more, ref int progress)
 {
     byte[] result;
     try
     {
         ExTraceGlobals.ServiceTracer.TraceDebug((long)this.GetHashCode(), "MsExchangeLogSearch server is entering Continue");
         this.WaitForSessionManager();
         resultSize = 0;
         more       = false;
         progress   = 0;
         LogSession logSession = this.sessionManager.GetSession(sessionId);
         try
         {
             byte[] array = new byte[Math.Min(resultLimit, 1048576)];
             resultSize = logSession.Read(array, 0, array.Length, out more, out progress, !continueInBackground);
             if (more && continueInBackground)
             {
                 ExTraceGlobals.ServiceTracer.TraceDebug((long)logSession.GetHashCode(), "Session continuing in background");
                 logSession = null;
             }
             result = array;
         }
         catch (LogSearchException ex)
         {
             PerfCounters.SearchesRejected.Increment();
             ExTraceGlobals.ServiceTracer.TraceDebug <LogSearchException>((long)logSession.GetHashCode(), "Continue was interrupted, Exception: {0}", ex);
             throw ex;
         }
         finally
         {
             if (logSession != null)
             {
                 ExTraceGlobals.ServiceTracer.TraceError <string>((long)this.GetHashCode(), "MsExchangeLogSearch LogSearchServer session {0} Continue failed", logSession.Id.ToString());
                 this.sessionManager.CloseSession(logSession);
             }
         }
     }
     catch (LogSearchException)
     {
         throw;
     }
     catch (Exception exception)
     {
         ExWatson.SendReportAndCrashOnAnotherThread(exception);
         result = null;
     }
     return(result);
 }
示例#3
0
        // Token: 0x060000F7 RID: 247 RVA: 0x00007404 File Offset: 0x00005604
        public LogSession CreateSession(string name, Version schemaVersion)
        {
            ExTraceGlobals.ServiceTracer.TraceDebug((long)this.GetHashCode(), "MsExchangeLogSearch LogSessionManager CreateSession");
            LogSession result;

            lock (this.sessionLock)
            {
                if (this.stopping)
                {
                    throw new LogSearchException(LogSearchErrorCode.LOGSEARCH_E_SESSION_CANCELED);
                }
                Log log;
                if (!this.logs.TryGetValue(name, out log))
                {
                    throw new LogSearchException(LogSearchErrorCode.LOGSEARCH_E_LOG_UNKNOWN_LOG);
                }
                if (this.sessions.Count == 100)
                {
                    LogSearchException ex            = new LogSearchException(LogSearchErrorCode.LOGSEARCH_E_SERVER_TOO_BUSY);
                    StringBuilder      stringBuilder = new StringBuilder(5300);
                    foreach (KeyValuePair <Guid, LogSession> keyValuePair in this.sessions)
                    {
                        stringBuilder.Append(keyValuePair.Key.ToString("N"));
                        stringBuilder.Append(":");
                        stringBuilder.Append(keyValuePair.Value.LastActivity.ToString("y/M/d:H:m:s"));
                        stringBuilder.Append(",");
                    }
                    ExWatson.AddExtraData(stringBuilder.ToString());
                    DiagnosticWatson.SendWatsonWithoutCrash(ex, "MaxSessionExceeded", TimeSpan.FromDays(1.0));
                    throw ex;
                }
                LogSession logSession = new LogSession(Guid.NewGuid(), log, schemaVersion);
                this.sessions[logSession.Id] = logSession;
                result = logSession;
            }
            return(result);
        }
 // Token: 0x06000104 RID: 260 RVA: 0x00007A14 File Offset: 0x00005C14
 public override byte[] SearchExtensibleSchema(string clientVersion, string logName, byte[] query, bool continueInBackground, int resultLimit, ref int resultSize, ref Guid sessionId, ref bool more, ref int progress, string clientName)
 {
     byte[] result;
     try
     {
         ExTraceGlobals.ServiceTracer.TraceDebug((long)this.GetHashCode(), "MsExchangeLogSearch server is entering Search using extensible result schema.");
         PerfCounters.SearchesProcessed.Increment();
         this.WaitForSessionManager();
         resultSize = 0;
         sessionId  = Guid.Empty;
         more       = false;
         progress   = 0;
         if (query.Length > 65536)
         {
             ExTraceGlobals.ServiceTracer.TraceError <int>((long)this.GetHashCode(), "Search rejected because the query was too complex. Query length: {0}", query.Length);
             PerfCounters.SearchesRejected.Increment();
             throw new LogSearchException(LogSearchErrorCode.LOGSEARCH_E_QUERY_TOO_COMPLEX);
         }
         Version    schemaVersion = new Version(clientVersion);
         LogSession logSession    = this.sessionManager.CreateSession(logName, schemaVersion);
         try
         {
             LogQuery query2 = LogSearchServer.DeserializeQuery(query);
             logSession.SetQuery(query2);
             if (LogSearchServer.logger.IsEventCategoryEnabled(MSExchangeTransportLogSearchEventLogConstants.Tuple_LogSearchClientQuery.CategoryId, MSExchangeTransportLogSearchEventLogConstants.Tuple_LogSearchClientQuery.Level))
             {
                 LogSearchServer.logger.LogEvent(MSExchangeTransportLogSearchEventLogConstants.Tuple_LogSearchClientQuery, null, new object[]
                 {
                     clientName,
                     Encoding.UTF8.GetString(query)
                 });
             }
             byte[] array = new byte[Math.Min(resultLimit, 1048576)];
             resultSize = logSession.Read(array, 0, array.Length, out more, out progress, !continueInBackground);
             if (more && continueInBackground)
             {
                 sessionId  = logSession.Id;
                 logSession = null;
             }
             result = array;
         }
         catch (LogSearchException ex)
         {
             PerfCounters.SearchesRejected.Increment();
             ExTraceGlobals.ServiceTracer.TraceDebug <LogSearchException>((long)logSession.GetHashCode(), "Search was interrupted, Exception: {0}", ex);
             throw ex;
         }
         finally
         {
             if (logSession != null)
             {
                 ExTraceGlobals.ServiceTracer.TraceError <string>((long)this.GetHashCode(), "MsExchangeLogSearch LogSearchServer session {0} Search failed", logSession.Id.ToString());
                 this.sessionManager.CloseSession(logSession);
             }
         }
     }
     catch (LogSearchException)
     {
         throw;
     }
     catch (Exception exception)
     {
         ExWatson.SendReportAndCrashOnAnotherThread(exception);
         result = null;
     }
     return(result);
 }