Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A problem to show how useful stream recording helpers are #351

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion source/Halibut.Tests/Halibut.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Nullable>enable</Nullable>
</PropertyGroup>
<PropertyGroup Condition="!$([MSBuild]::IsOSUnixLike())">
<TargetFrameworks>net48;net6.0</TargetFrameworks>
<TargetFrameworks>net48;net6.0</TargetFrameworks>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSUnixLike())">
<TargetFramework>net6.0</TargetFramework>
Expand Down
3 changes: 2 additions & 1 deletion source/Halibut.Tests/UsageFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ public async Task OctopusCanSendMessagesToTentacle_WithSupportedServices(ClientA
}

[Test]
[LatestAndPreviousClientAndServiceVersionsTestCases]
//[LatestAndPreviousClientAndServiceVersionsTestCases()]
[LatestClientAndLatestServiceTestCases()]
[FailedWebSocketTestsBecomeInconclusive]
public async Task StreamsCanBeSent(ClientAndServiceTestCase clientAndServiceTestCase)
{
Expand Down
7 changes: 5 additions & 2 deletions source/Halibut/Transport/Protocol/MessageExchangeStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,13 @@ public RemoteIdentity ReadRemoteIdentity()

public void Send<T>(T message)
{
Stream stream = this.stream;
stream = new BufferedStream(stream, 10000000);
using (var capture = StreamCapture.New())
{
serializer.WriteMessage(stream, message);
WriteEachStream(capture.SerializedStreams);
WriteEachStream(capture.SerializedStreams, stream);
stream.Flush();
}

log.Write(EventType.Diagnostic, "Sent: {0}", message);
Expand Down Expand Up @@ -275,7 +278,7 @@ static DataStream FindStreamById(StreamCapture capture, Guid id)
return dataStream;
}

void WriteEachStream(IEnumerable<DataStream> streams)
void WriteEachStream(IEnumerable<DataStream> streams, Stream stream)
{
foreach (var dataStream in streams)
{
Expand Down