Skip to content

Commit

Permalink
feat: Added PipeServer.CreatePipeStreamForConnectionFunc.
Browse files Browse the repository at this point in the history
  • Loading branch information
HavenDV committed Dec 8, 2023
1 parent 5048d67 commit bd85946
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/libs/H.Pipes/PipeServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ public sealed class PipeServer<T> : IPipeServer<T>
/// </summary>
public Func<string, NamedPipeServerStream>? CreatePipeStreamFunc { get; set; }

/// <summary>
/// If set, used instead of CreatePipeStreamFunc for connections
/// </summary>
public Func<string, NamedPipeServerStream>? CreatePipeStreamForConnectionFunc { get; set; }

/// <summary>
/// PipeStreamInitializeAction
/// </summary>
Expand Down Expand Up @@ -196,7 +201,7 @@ await handshakeWrapper.WriteAsync(Encoding.UTF8.GetBytes(connectionPipeName), to
}
// Wait for the client to connect to the data pipe
var connectionStream = CreatePipeStreamFunc?.Invoke(connectionPipeName) ?? PipeServerFactory.Create(connectionPipeName);
var connectionStream = (CreatePipeStreamForConnectionFunc ?? CreatePipeStreamFunc)?.Invoke(connectionPipeName) ?? PipeServerFactory.Create(connectionPipeName);
PipeStreamInitializeAction?.Invoke(connectionStream);
Expand Down

0 comments on commit bd85946

Please sign in to comment.