-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support for pipestream for multiple httpclient support
- Loading branch information
1 parent
0b736ea
commit 0e3a099
Showing
8 changed files
with
256 additions
and
27 deletions.
There are no files selected for viewing
3 changes: 2 additions & 1 deletion
3
src/CSharp/EasyMicroservices.Laboratory.Tests/EasyMicroservices.Laboratory.Tests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ | |
<Platforms>AnyCPU;x64;x86</Platforms> | ||
<Authors>EasyMicroservices</Authors> | ||
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> | ||
<Version>0.0.0.11</Version> | ||
<Version>0.0.0.12</Version> | ||
<Description>Laboratory of http client.</Description> | ||
<Copyright>[email protected]</Copyright> | ||
<PackageTags>test,tests,http,https,httpclient,laboratory</PackageTags> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
src/CSharp/EasyMicroservices.Laboratory/IO/PipelineStream.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
using System.IO; | ||
using System.Net.Sockets; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace EasyMicroservices.Laboratory.IO | ||
{ | ||
/// <summary> | ||
/// | ||
/// </summary> | ||
internal class PipelineStream : Stream | ||
{ | ||
PipelineStreamReader pipelineStreamReader; | ||
NetworkStream _stream; | ||
public PipelineStream(NetworkStream stream) | ||
{ | ||
_stream = stream; | ||
pipelineStreamReader = new PipelineStreamReader(_stream); | ||
} | ||
|
||
public override bool CanRead => _stream.CanRead; | ||
|
||
public override bool CanSeek => _stream.CanSeek; | ||
|
||
public override bool CanWrite => _stream.CanWrite; | ||
|
||
public override long Length => _stream.Length; | ||
|
||
public override long Position { get => _stream.Position; set => _stream.Position = value; } | ||
|
||
public override void Flush() | ||
{ | ||
_stream.Flush(); | ||
} | ||
|
||
public override int Read(byte[] buffer, int offset, int count) | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
|
||
public override long Seek(long offset, SeekOrigin origin) | ||
{ | ||
return _stream.Seek(offset, origin); | ||
} | ||
|
||
public override void SetLength(long value) | ||
{ | ||
_stream.SetLength(Length); | ||
} | ||
|
||
public override void Write(byte[] buffer, int offset, int count) | ||
{ | ||
throw new System.NotImplementedException(); | ||
} | ||
|
||
public override Task<int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) | ||
{ | ||
return pipelineStreamReader.ReadAsync(buffer, count); | ||
} | ||
|
||
public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) | ||
{ | ||
return _stream.WriteAsync(buffer, offset, count, cancellationToken); | ||
} | ||
|
||
protected override void Dispose(bool disposing) | ||
{ | ||
base.Dispose(disposing); | ||
_stream.Dispose(); | ||
pipelineStreamReader.Dispose(); | ||
} | ||
} | ||
} |
Oops, something went wrong.