@@ -147,17 +147,28 @@ public ValueTask HandleTransactionStartAsync(
147147 }
148148
149149 /// <remarks>
150- /// In the default implementation, a banner response is sent back to the client.
150+ /// In the default implementation, <see cref="ITransactionCallback.StartTransactionAsync"/> is
151+ /// called for <see cref="IPluginProvider"/> and <see cref="IPlugin"/>s,
152+ /// and then a banner response is sent back to the client.
151153 /// </remarks>
152- protected virtual ValueTask HandleTransactionStartAsyncCore (
154+ protected virtual async ValueTask HandleTransactionStartAsyncCore (
153155 IMuninNodeClient client ,
154156 CancellationToken cancellationToken
155157 )
156- => SendResponseAsync (
158+ {
159+ if ( profile . PluginProvider is ITransactionCallback providerTransactionCallback )
160+ await providerTransactionCallback . StartTransactionAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
161+
162+ foreach ( var pluginTransactionCallback in plugins . Values . OfType < ITransactionCallback > ( ) ) {
163+ await pluginTransactionCallback . StartTransactionAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
164+ }
165+
166+ await SendResponseAsync (
157167 client ,
158168 banner ,
159169 cancellationToken
160- ) ;
170+ ) . ConfigureAwait ( false ) ;
171+ }
161172
162173 /// <inheritdoc cref="IMuninProtocolHandler.HandleTransactionEndAsync"/>
163174 public ValueTask HandleTransactionEndAsync (
@@ -178,11 +189,22 @@ public ValueTask HandleTransactionEndAsync(
178189 return HandleTransactionEndAsyncCore ( client , cancellationToken ) ;
179190 }
180191
181- protected virtual ValueTask HandleTransactionEndAsyncCore (
192+ /// <remarks>
193+ /// In the default implementation, <see cref="ITransactionCallback.EndTransactionAsync"/> is
194+ /// called for <see cref="IPluginProvider"/> and <see cref="IPlugin"/>s.
195+ /// </remarks>
196+ protected virtual async ValueTask HandleTransactionEndAsyncCore (
182197 IMuninNodeClient client ,
183198 CancellationToken cancellationToken
184199 )
185- => default ; // do nothing in this class
200+ {
201+ foreach ( var pluginTransactionCallback in plugins . Values . OfType < ITransactionCallback > ( ) ) {
202+ await pluginTransactionCallback . EndTransactionAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
203+ }
204+
205+ if ( profile . PluginProvider is ITransactionCallback providerTransactionCallback )
206+ await providerTransactionCallback . EndTransactionAsync ( cancellationToken ) . ConfigureAwait ( false ) ;
207+ }
186208
187209 private static bool ExpectCommand (
188210 ReadOnlySequence < byte > commandLine ,
0 commit comments