Skip to content

Commit 0a04c76

Browse files
committed
完善管道处理逻辑。
1 parent c1536b1 commit 0a04c76

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Quick.Protocol.Pipeline/QpPipelineClient.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,16 @@ public QpPipelineClient(QpPipelineClientOptions options) : base(options)
2121

2222
protected override async Task<Stream> InnerConnectAsync()
2323
{
24-
pipeClientStream = new NamedPipeClientStream(options.ServerName, options.PipeName, PipeDirection.InOut, PipeOptions.Asynchronous);
2524
try
2625
{
26+
pipeClientStream = new NamedPipeClientStream(options.ServerName, options.PipeName, PipeDirection.InOut, PipeOptions.Asynchronous);
2727
await pipeClientStream.ConnectAsync(options.ConnectionTimeout).ConfigureAwait(false);
2828
}
2929
catch
3030
{
31-
pipeClientStream.Dispose();
31+
try { pipeClientStream?.Dispose(); }
32+
catch { }
33+
pipeClientStream = null;
3234
throw;
3335
}
3436
pipeClientStream.ReadMode = PipeTransmissionMode.Byte;

0 commit comments

Comments
 (0)