/// <summary> /// Handles 'message' events of the Fabric layer. /// </summary> /// <param name="server">The server which is sending the frame.</param> /// <param name="buffer">The buffer to process.</param> /// <returns>The processing state of the event.</returns> internal ProcessingState OnFrame(IServer server, BufferSegment buffer) { if (server == null || buffer == null) { return(ProcessingState.Failure); } int count = this.Registry.RawCount; for (int i = 0; i < count; ++i) { if (this.Registry.HasElementAt(i)) { var handler = this.Registry.Get(i); var result = handler.ProcessFrame(server, buffer.AsSegment()); if (result == ProcessingState.Failure) { continue; } return(result); } } // We failed processing return(ProcessingState.Failure); }
/// <summary> /// Logs an exception as a warning. /// </summary> /// <param name="exception">The exception object that contains the error.</param> /// <param name="buffer">The buffer for the log entry.</param> public virtual void Log(Exception exception, BufferSegment buffer) { Log(LogLevel.Error, exception, buffer.AsSegment()); }