Skip to content

Commit

Permalink
Clean up / Fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
juliusfriedman committed Nov 22, 2023
1 parent b9fbf5b commit 8a97baf
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Rtp/RtpClient.Methods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2652,7 +2652,7 @@ void SendReceieve()
//}
}

if (Common.IDisposedExtensions.IsNullOrDisposed(sendContext) || Common.IDisposedExtensions.IsNullOrDisposed(sendContext.Goodbye) is false) goto Done;
if (Common.IDisposedExtensions.IsNullOrDisposed(sendContext) || sendContext.Goodbye is not null) goto Done;

//Send the packet using the context's SynchronizationSourceIdentifier
if (SendRtpPacket(packet, sendContext, out lastError, sendContext.SynchronizationSourceIdentifier) >= packet.Length /* && lastError == SocketError.Success*/)
Expand Down
1 change: 1 addition & 0 deletions Rtsp/RtspClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3990,6 +3990,7 @@ public RtspMessage SendRtspMessage(RtspMessage message, out SocketError error, o
//TCP RST occurs when the ACK is missed so keep the window open.
if (IsConnected &&
SharesSocket is false &&
m_RtspSocket.IsNullOrDisposed() is false &&
m_RtspSocket.Poll(m_SocketPollMicroseconds >> 4, SelectMode.SelectRead) /*&& m_RtspSocket.Available > 0*/)
{
//Receive if data is actually available.
Expand Down
12 changes: 6 additions & 6 deletions UnitTests/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public static async Task Main(string[] args)

RunTest(async () =>
{
await RunTestAsync(TestServerAsync, nameof(TestServerAsync));
await RunTestAsync(TestServerAsync).ConfigureAwait(false);
});
}

Expand Down Expand Up @@ -4629,10 +4629,10 @@ static void RunTest(Action test, int count = 1, bool waitForGoAhead = true)
System.Console.Clear();
Console.WriteLine("About to run test: " + test.Method.Name);
Console.WriteLine("Press Q to skip or any other key to continue.");
RunTestAsync(() => { test(); return Task.CompletedTask; }, test.Method.Name, count, waitForGoAhead).GetAwaiter().GetResult();
RunTestAsync(() => { test(); return Task.CompletedTask; }, count, waitForGoAhead).GetAwaiter().GetResult();
}

static async Task RunTestAsync(Func<Task> test, string testMethodName, int count = 1, bool waitForGoAhead = true)
static async Task RunTestAsync(Func<Task> test, int count = 1, bool waitForGoAhead = true)
{
//If the debugger is attached get a ConsoleKey, the key is Q return.
if (waitForGoAhead && /*System.Diagnostics.Debugger.IsAttached && */ Console.ReadKey(true).Key == ConsoleKey.Q) return;
Expand All @@ -4652,12 +4652,12 @@ static async Task RunTestAsync(Func<Task> test, string testMethodName, int count
//Decrement remaining
--remaining;

TraceMessage("Beginning Test '" + testIndex + "'" + testMethodName);
TraceMessage("Beginning Test '" + testIndex + "'");

//Run the test
await test().ConfigureAwait(false);

TraceMessage("Completed Test'" + testIndex + "'" + testMethodName);
TraceMessage("Completed Test'" + testIndex + "'");

//Increment the success counter
++successes;
Expand Down Expand Up @@ -4706,7 +4706,7 @@ static async Task RunTestAsync(Func<Task> test, string testMethodName, int count
{
case ConsoleKey.W:
{
await RunTestAsync(test, testMethodName, 1, false).ConfigureAwait(false);
await RunTestAsync(test, 1, false).ConfigureAwait(false);
return;
}
case ConsoleKey.D:
Expand Down

0 comments on commit 8a97baf

Please sign in to comment.