Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

Commit

Permalink
Fixed tests IP address connection.
Browse files Browse the repository at this point in the history
  • Loading branch information
DJGosnell committed Oct 30, 2017
1 parent e6d7b62 commit fd85b2e
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,15 @@ public override void StartClient()
var configClients = ActualControl.ConfigClients;
var configPackageLength = ActualControl.ConfigBytesPerMessage;
var configPeriod = ActualControl.ConfigMessagePeriod;
var addressParts = TestController.ControllClient.Config.Address.Split(':');

Task.Run(() =>
{
for (int i = 0; i < configClients; i++)
{
var client = new MqClient<ConnectionPerformanceTestSession, MqConfig>(new MqConfig
{
Address = TestController.ControllClient.Config.Address + ":2121",
Address = addressParts[0] + ":2121",
PingFrequency = 500
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,13 @@ public override void StartClient()
{
var configClientConnections = ActualControl.ConfigClients;
var configFrameSize = ActualControl.ConfigFrameSize;
var addressParts = TestController.ControllClient.Config.Address.Split(':');

for (int i = 0; i < configClientConnections; i++)
{
var client = new MqClient<EchoPerformanceTestSession, MqConfig>(new MqConfig
{
Address = TestController.ControllClient.Config.Address + ":2121",
Address = addressParts[0] + ":2121",
PingFrequency = 500
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,13 @@ public override void StartClient()
var configClientConnections = ActualControl.ConfigClients;
var configFrames = ActualControl.ConfigFrames;
var configFrameSize = ActualControl.ConfigFrameSize;
var addressParts = TestController.ControllClient.Config.Address.Split(':');

for (int i = 0; i < configClientConnections; i++)
{
var client = new MqClient<MaxThroughputPerformanceTestSession, MqConfig>(new MqConfig
{
Address = TestController.ControllClient.Config.Address + ":2121",
Address = addressParts[0] + ":2121",
PingFrequency = 500
});

Expand Down
17 changes: 15 additions & 2 deletions src/DtronixMessageQueue/MqSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,16 @@ private void ProcessIncomingQueue()
while (_inboxBytes.TryDequeue(out buffer))
{

if (CurrentState == State.Connected)
_receivingSemaphore.Release();
if (CurrentState != State.Connected)
return;

_receivingSemaphore.Release();

if (buffer == null)
{
Close(CloseReason.Closing);
return;
}

try
{
Expand All @@ -182,6 +187,9 @@ private void ProcessIncomingQueue()

for (var i = 0; i < frameCount; i++)
{
if (CurrentState != State.Connected)
return;

var frame = _frameBuilder.Frames.Dequeue();

// Do nothing if this is a ping frame.
Expand Down Expand Up @@ -250,6 +258,11 @@ public override void Close(CloseReason reason)
if (CurrentState == State.Closed && reason != CloseReason.ConnectionRefused)
return;

if (reason == CloseReason.ProtocolError)
{

}

MqFrame closeFrame = null;
if (CurrentState == State.Connected || reason == CloseReason.ConnectionRefused)
{
Expand Down

0 comments on commit fd85b2e

Please sign in to comment.