Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ryanwersal/MorseL
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2.2.6
Choose a base ref
...
head repository: ryanwersal/MorseL
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: production
Choose a head ref
  • 6 commits
  • 10 files changed
  • 3 contributors

Commits on Nov 26, 2019

  1. fixed issues with multiple middleware not being given the transformed… (

    #79)
    
    * fixed issues with multiple middleware not being given the transformed stream
    
    * bumped version to 2.2.6
    jpeters5392 authored and berdon committed Nov 26, 2019

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    8064827 View commit details

Commits on Jan 8, 2020

  1. Copy the full SHA
    a7dc1e3 View commit details
  2. Merge branch 'master' into production

    Austin Hanson committed Jan 8, 2020
    Copy the full SHA
    e55a4b9 View commit details
  3. Version bump to 2.2.7

    Austin Hanson committed Jan 8, 2020
    Copy the full SHA
    4e61cb0 View commit details

Commits on Feb 18, 2020

  1. Copy the full SHA
    886d290 View commit details
  2. Version bump to 2.2.8

    Austin Hanson committed Feb 18, 2020
    Copy the full SHA
    ed8e1ec View commit details
4 changes: 2 additions & 2 deletions deploy-nuget.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FILES=($(find ./output -name 'MorseL*.nupkg' | grep -v 'Test'))
for f in "${FILES[@]}"
do
nuget add $f -Source $1
done
dotnet nuget push $f -s $1
done
Empty file modified pack.sh
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions src/MorseL.Client/Connection.cs
Original file line number Diff line number Diff line change
@@ -572,10 +572,10 @@ await receiveDelegator(new ConnectionContext(_clientWebSocket, stream))
}
catch (WebSocketException e) when (e.Message == "The remote party closed the WebSocket connection without completing the close handshake.")
{
_logger.LogWarning("Observed WebSocketException - likely OK");
_logger.LogWarning("Observed WebSocketException - likely server closing our connection");

// Eat the exception because we're closing
closingException = e;
closingException = new WebSocketClosedException("Observed WebSocketException - likely server closing our connection", e);

try
{
2 changes: 1 addition & 1 deletion src/MorseL.Scaleout.Redis/MorseL.Scaleout.Redis.csproj
Original file line number Diff line number Diff line change
@@ -18,7 +18,7 @@
<ProjectReference Include="..\MorseL\MorseL.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="StackExchange.Redis.StrongName" Version="1.2.6" />
<PackageReference Include="StackExchange.Redis" Version="2.0.601" />
<PackageReference Include="Newtonsoft.Json" Version="10.0.2" />
</ItemGroup>
</Project>
38 changes: 13 additions & 25 deletions src/MorseL.Scaleout.Redis/RedisBackplane.cs
Original file line number Diff line number Diff line change
@@ -52,6 +52,8 @@ public class RedisBackplane : IBackplane
/// </summary>
private readonly IDictionary<string, IDictionary<string, object>> _subscriptions = new ConcurrentDictionary<string, IDictionary<string, object>>();

internal int OnMessageCount => _connections.Count();

public RedisBackplane(IOptions<ConfigurationOptions> options)
{
_lazyConnection = new Lazy<ConnectionMultiplexer>(() => ConnectionMultiplexer.Connect(options.Value));
@@ -71,18 +73,9 @@ await InvokeOnMessage(
);
}

internal int OnMessageCount => _onMessage?.GetInvocationList().Count() ?? 0;
private OnMessageDelegate _onMessage;

public async Task OnClientConnectedAsync(string connectionId, OnMessageDelegate onMessageDelegate)
{
_connections.Add(connectionId, onMessageDelegate);

if (onMessageDelegate != null)
{
_onMessage += onMessageDelegate;
}

var subscriber = Cache.Multiplexer.GetSubscriber();

// Subscribe to messages for the client
@@ -94,13 +87,7 @@ await subscriber.SubscribeAsync(

public async Task OnClientDisconnectedAsync(string connectionId)
{
if (_connections.TryGetValue(connectionId, out var onMessageDelegate) && onMessageDelegate != null)
{
_onMessage -= onMessageDelegate;
}

_connections.Remove(connectionId);

var subscriber = Cache.Multiplexer.GetSubscriber();

// Unsubscribe for messages to the client
@@ -116,14 +103,14 @@ await subscriber.UnsubscribeAsync(
await Unsubscribe(group, connectionId);
}
}
}

public async Task DisconnectClientAsync(string connectionId)
{
await SendMessageAsync(connectionId, new Message
{
MessageType = MessageType.Disconnect
});
}

public async Task DisconnectClientAsync(string connectionId)
{
await SendMessageAsync(connectionId, new Message
{
MessageType = MessageType.Disconnect
});
}

public async Task SendMessageAsync(string connectionId, Message message)
@@ -234,8 +221,9 @@ await subscriber.PublishAsync(
}

private async Task InvokeOnMessage(RedisChannel connectionId, RedisValue message) {
if (_onMessage != null) {
await _onMessage(
if (_connections.TryGetValue(connectionId, out var messageDelegate) && messageDelegate != null)
{
await messageDelegate.Invoke(
connectionId,
JsonConvert.DeserializeObject<Message>(message)
).ConfigureAwait(false);
18 changes: 3 additions & 15 deletions src/MorseL.Scaleout/DefaultBackplane.cs
Original file line number Diff line number Diff line change
@@ -15,29 +15,17 @@ public class DefaultBackplane : IBackplane
private readonly IDictionary<string, IDictionary<string, object>> _groups = new ConcurrentDictionary<string, IDictionary<string, object>>();
private readonly IDictionary<string, IDictionary<string, object>> _subscriptions = new ConcurrentDictionary<string, IDictionary<string, object>>();

internal int OnMessageCount => _onMessage?.GetInvocationList().Count() ?? 0;
private OnMessageDelegate _onMessage;
internal int OnMessageCount => _connections.Count();

public Task OnClientConnectedAsync(string connectionId, OnMessageDelegate onMessageDelegate)
{
_connections.Add(connectionId, onMessageDelegate);

if (onMessageDelegate != null)
{
_onMessage += onMessageDelegate;
}

return Task.CompletedTask;
}

public async Task OnClientDisconnectedAsync(string connectionId)
{
// Deregister the message delegate
if (_connections.TryGetValue(connectionId, out OnMessageDelegate onMessageDelegate) && onMessageDelegate != null)
{
_onMessage -= onMessageDelegate;
}

_connections.Remove(connectionId);

// Unsubscribe from groups
@@ -140,8 +128,8 @@ public async Task UnsubscribeAll(string group)
}

private async Task InvokeOnMessage(string connectionId, Message message) {
if (_onMessage != null) {
await _onMessage(connectionId, message)
if (_connections.TryGetValue(connectionId, out var messageDelegate) && messageDelegate != null) {
await messageDelegate.Invoke(connectionId, message)
.ConfigureAwait(false);
}
}
2 changes: 0 additions & 2 deletions src/MorseL/HubWebSocketHandler.cs
Original file line number Diff line number Diff line change
@@ -80,8 +80,6 @@ await _backplane.OnClientConnectedAsync(
connection.Id,
async (connectionId, message) =>
{
if (!connectionId.Equals(connection.Id)) return;

// Disconnect messages don't really get sent to the client.
// Instead, the server initiates the closing of the connection.
if (message.MessageType == MessageType.Disconnect)
Empty file modified test.sh
100644 → 100755
Empty file.
Original file line number Diff line number Diff line change
@@ -7,7 +7,6 @@

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" />
<PackageReference Include="Microsoft.AspNetCore.All" Version="2.0.0" />
<PackageReference Include="xunit" Version="2.4.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
</ItemGroup>
2 changes: 1 addition & 1 deletion version.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<VersionPrefix>2.2.6</VersionPrefix>
<VersionPrefix>2.2.8</VersionPrefix>
</PropertyGroup>
</Project>