This is an automated email from the ASF dual-hosted git repository. tabish pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/qpid-proton-dotnet.git
The following commit(s) were added to refs/heads/main by this push: new 2204a20 PROTON-2732 Wire the engine configuration for frame tracing 2204a20 is described below commit 2204a206338d1ae8d28066a9debcd914b7082dcd Author: Timothy Bish <tabish...@gmail.com> AuthorDate: Wed May 10 10:11:32 2023 -0400 PROTON-2732 Wire the engine configuration for frame tracing Check the pipeline in the engine and if the logging handler is present then get or set the frame tracing value as specified. --- .../Implementation/ProtonEngineConfiguration.cs | 27 ++++++++++++++++++++-- .../Engine/Implementation/ProtonEngineTest.cs | 20 ++++++++++++++++ 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/Proton/Engine/Implementation/ProtonEngineConfiguration.cs b/src/Proton/Engine/Implementation/ProtonEngineConfiguration.cs index d106117..610d6e9 100644 --- a/src/Proton/Engine/Implementation/ProtonEngineConfiguration.cs +++ b/src/Proton/Engine/Implementation/ProtonEngineConfiguration.cs @@ -17,6 +17,7 @@ using System; using Apache.Qpid.Proton.Buffer; +using Apache.Qpid.Proton.Logging; namespace Apache.Qpid.Proton.Engine.Implementation { @@ -27,6 +28,8 @@ namespace Apache.Qpid.Proton.Engine.Implementation /// </summary> public sealed class ProtonEngineConfiguration : IEngineConfiguration { + private static readonly IProtonLogger LOG = ProtonLoggerFactory.GetLogger<ProtonEngine>(); + private readonly ProtonEngine engine; private IProtonBufferAllocator allocator = ProtonByteBufferAllocator.Instance; @@ -47,8 +50,28 @@ namespace Apache.Qpid.Proton.Engine.Implementation public bool TraceFrames { - get => throw new NotImplementedException(); - set => throw new NotImplementedException(); + get + { + if (engine.Pipeline.Find(ProtonConstants.FrameLoggingHandler) is ProtonFrameLoggingHandler loggingHandler) + { + return loggingHandler.TraceFrames; + } + else + { + return false; + } + } + set + { + if (engine.Pipeline.Find(ProtonConstants.FrameLoggingHandler) is ProtonFrameLoggingHandler loggingHandler) + { + loggingHandler.TraceFrames = value; + } + else + { + LOG.Debug("Engine not configured with a frame logging handler: cannot apply traceFrames={0}", value); + } + } } public uint OutboundMaxFrameSize => effectiveMaxOutboundFrameSize; diff --git a/test/Proton.Tests/Engine/Implementation/ProtonEngineTest.cs b/test/Proton.Tests/Engine/Implementation/ProtonEngineTest.cs index caafa51..a24192e 100644 --- a/test/Proton.Tests/Engine/Implementation/ProtonEngineTest.cs +++ b/test/Proton.Tests/Engine/Implementation/ProtonEngineTest.cs @@ -1432,5 +1432,25 @@ namespace Apache.Qpid.Proton.Engine.Implementation peer.WaitForScriptToComplete(); } + + [Test] + public void TestEngineConfigurationAllowsTraceFramesWhenHandlerPresent() + { + IEngine engine = IEngineFactory.Proton.CreateNonSaslEngine(); + engine.ErrorHandler((error) => failure = error.FailureCause); + + ProtonTestConnector peer = CreateTestPeer(engine); + + IConnection connection = engine.Connection.Open(); + + peer.WaitForScriptToComplete(); + + Assert.IsFalse(engine.Configuration.TraceFrames); + engine.Configuration.TraceFrames = true; + Assert.IsTrue(engine.Configuration.TraceFrames); + Assert.IsNull(failure); + + peer.WaitForScriptToComplete(); + } } } \ No newline at end of file --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org