Skip to content

Commit

Permalink
[FIX] Adapt to changes in SWAN 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rdeago authored and geoperez committed Feb 12, 2020
1 parent 3012566 commit cc2f587
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/EmbedIO/RequestDeserializer.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;
using System.Threading.Tasks;
using Swan;
using Swan.Formatters;
using Swan.Logging;

namespace EmbedIO
Expand Down
11 changes: 7 additions & 4 deletions src/EmbedIO/Sessions/LocalSessionManager.SessionImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@
using System.Collections.Generic;
using System.Linq;
using EmbedIO.Utilities;
using Swan.Collections;

namespace EmbedIO.Sessions
{
partial class LocalSessionManager
{
private class SessionImpl : ISession
{
private readonly DataDictionary<string, object> _data = new DataDictionary<string, object>(Session.KeyComparer);
private readonly Dictionary<string, object> _data = new Dictionary<string, object>(Session.KeyComparer);

private int _usageCount;

Expand Down Expand Up @@ -45,7 +44,7 @@ public bool IsEmpty
{
lock (_data)
{
return _data.IsEmpty;
return _data.Count == 0;
}
}
}
Expand Down Expand Up @@ -88,7 +87,11 @@ public bool TryRemove(string key, out object value)
{
lock (_data)
{
return _data.TryRemove(key, out value);
if (!_data.TryGetValue(key, out value))
return false;

_data.Remove(key);
return true;
}
}

Expand Down

0 comments on commit cc2f587

Please sign in to comment.