Skip to content

Commit

Permalink
Pubnub Instance Destroy fix (#153)
Browse files Browse the repository at this point in the history
* Fix for listeners when destroy is called
* RemoveHttpClients condition
  • Loading branch information
budgetpreneur authored Aug 10, 2022
1 parent 60b601b commit d2f13c2
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 22 deletions.
19 changes: 12 additions & 7 deletions .pubnub.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
name: c-sharp
version: "6.7.0"
version: "6.8.0"
schema: 1
scm: github.com/pubnub/c-sharp
changelog:
- date: 2022-08-10
version: v6.8.0
changes:
- type: bug
text: "Fixed Destroy() method when multiple Pubnub instances were in use."
- date: 2022-07-27
version: v6.7.0
changes:
Expand Down Expand Up @@ -665,7 +670,7 @@ features:
- QUERY-PARAM
supported-platforms:
-
version: Pubnub 'C#' 6.7.0
version: Pubnub 'C#' 6.8.0
platforms:
- Windows 10 and up
- Windows Server 2008 and up
Expand All @@ -675,7 +680,7 @@ supported-platforms:
- .Net Framework 4.5
- .Net Framework 4.6.1+
-
version: PubnubPCL 'C#' 6.7.0
version: PubnubPCL 'C#' 6.8.0
platforms:
- Xamarin.Android
- Xamarin.iOS
Expand All @@ -695,7 +700,7 @@ supported-platforms:
- .Net Core
- .Net 6.0
-
version: PubnubUWP 'C#' 6.7.0
version: PubnubUWP 'C#' 6.8.0
platforms:
- Windows Phone 10
- Universal Windows Apps
Expand All @@ -719,7 +724,7 @@ sdks:
distribution-type: source
distribution-repository: GitHub
package-name: Pubnub
location: https://github.com/pubnub/c-sharp/releases/tag/v6.7.0.0
location: https://github.com/pubnub/c-sharp/releases/tag/v6.8.0.0
requires:
-
name: ".Net"
Expand Down Expand Up @@ -1002,7 +1007,7 @@ sdks:
distribution-type: source
distribution-repository: GitHub
package-name: PubNubPCL
location: https://github.com/pubnub/c-sharp/releases/tag/v6.7.0.0
location: https://github.com/pubnub/c-sharp/releases/tag/v6.8.0.0
requires:
-
name: ".Net Core"
Expand Down Expand Up @@ -1361,7 +1366,7 @@ sdks:
distribution-type: source
distribution-repository: GitHub
package-name: PubnubUWP
location: https://github.com/pubnub/c-sharp/releases/tag/v6.7.0.0
location: https://github.com/pubnub/c-sharp/releases/tag/v6.8.0.0
requires:
-
name: "Universal Windows Platform Development"
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v6.8.0 - August 10 2022
-----------------------------
- Fixed: fixed Destroy() method when multiple Pubnub instances were in use.

v6.7.0 - July 27 2022
-----------------------------
- Modified: added support for Users/Spaces to GrantToken.
Expand Down
4 changes: 2 additions & 2 deletions src/Api/PubnubApi/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
[assembly: AssemblyProduct("Pubnub C# SDK")]
[assembly: AssemblyCopyright("Copyright © 2021")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyVersion("6.7.0.0")]
[assembly: AssemblyFileVersion("6.7.0.0")]
[assembly: AssemblyVersion("6.8.0.0")]
[assembly: AssemblyFileVersion("6.8.0.0")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
Expand Down
4 changes: 2 additions & 2 deletions src/Api/PubnubApi/PubnubApi.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@

<PropertyGroup>
<PackageId>Pubnub</PackageId>
<PackageVersion>6.7.0.0</PackageVersion>
<PackageVersion>6.8.0.0</PackageVersion>
<Title>PubNub C# .NET - Web Data Push API</Title>
<Authors>Pandu Masabathula</Authors>
<Owners>PubNub</Owners>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<PackageIconUrl>http://pubnub.s3.amazonaws.com/2011/powered-by-pubnub/pubnub-icon-600x600.png</PackageIconUrl>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<RepositoryUrl>https://github.com/pubnub/c-sharp/</RepositoryUrl>
<PackageReleaseNotes>Added support for Users/Spaces to GrantToken.</PackageReleaseNotes>
<PackageReleaseNotes>Fixed Destroy() method when multiple Pubnub instances were in use.</PackageReleaseNotes>
<PackageTags>Web Data Push Real-time Notifications ESB Message Broadcasting Distributed Computing</PackageTags>
<!--<Summary>PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously</Summary>-->
<Description>PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously</Description>
Expand Down
14 changes: 10 additions & 4 deletions src/Api/PubnubApi/PubnubCoreBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2273,7 +2273,10 @@ protected bool DeleteLocalChannelGroupUserState(string channelGroup)

internal void EndPendingRequests()
{
SubscribeCallbackListenerList.Clear();
if (SubscribeCallbackListenerList.ContainsKey(PubnubInstance.InstanceId))
{
SubscribeCallbackListenerList[PubnubInstance.InstanceId].Clear();
}

RemoveChannelDictionary();
TerminatePendingWebRequest();
Expand Down Expand Up @@ -2314,8 +2317,11 @@ internal void EndPendingRequests()
ChannelGroupUserState[PubnubInstance.InstanceId].Clear();
}

RemoveHttpClients();

if (MultiChannelSubscribe.Count > 0 && MultiChannelSubscribe.Where(t => t.Value.Keys.Count > 0).Count() == 0
&& MultiChannelGroupSubscribe.Count > 0 && MultiChannelGroupSubscribe.Where(t => t.Value.Keys.Count > 0).Count() == 0)
{
RemoveHttpClients();
}
PubnubInstance = null;
}

Expand Down Expand Up @@ -2352,7 +2358,7 @@ internal static void RemoveHttpClients()
}
#endif
}

internal void TerminateCurrentSubscriberRequest()
{
string[] channels = GetCurrentSubscriberChannels();
Expand Down
4 changes: 2 additions & 2 deletions src/Api/PubnubApiPCL/PubnubApiPCL.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@

<PropertyGroup>
<PackageId>PubnubPCL</PackageId>
<PackageVersion>6.7.0.0</PackageVersion>
<PackageVersion>6.8.0.0</PackageVersion>
<Title>PubNub C# .NET - Web Data Push API</Title>
<Authors>Pandu Masabathula</Authors>
<Owners>PubNub</Owners>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<PackageIconUrl>http://pubnub.s3.amazonaws.com/2011/powered-by-pubnub/pubnub-icon-600x600.png</PackageIconUrl>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<RepositoryUrl>https://github.com/pubnub/c-sharp/</RepositoryUrl>
<PackageReleaseNotes>Added support for Users/Spaces to GrantToken.</PackageReleaseNotes>
<PackageReleaseNotes>Fixed Destroy() method when multiple Pubnub instances were in use.</PackageReleaseNotes>
<PackageTags>Web Data Push Real-time Notifications ESB Message Broadcasting Distributed Computing</PackageTags>
<!--<Summary>PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously</Summary>-->
<Description>PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously</Description>
Expand Down
4 changes: 2 additions & 2 deletions src/Api/PubnubApiUWP/PubnubApiUWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@

<PropertyGroup>
<PackageId>PubnubUWP</PackageId>
<PackageVersion>6.7.0.0</PackageVersion>
<PackageVersion>6.8.0.0</PackageVersion>
<Title>PubNub C# .NET - Web Data Push API</Title>
<Authors>Pandu Masabathula</Authors>
<Owners>PubNub</Owners>
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
<PackageIconUrl>http://pubnub.s3.amazonaws.com/2011/powered-by-pubnub/pubnub-icon-600x600.png</PackageIconUrl>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<RepositoryUrl>https://github.com/pubnub/c-sharp/</RepositoryUrl>
<PackageReleaseNotes>Added support for Users/Spaces to GrantToken.</PackageReleaseNotes>
<PackageReleaseNotes>Fixed Destroy() method when multiple Pubnub instances were in use.</PackageReleaseNotes>
<PackageTags>Web Data Push Real-time Notifications ESB Message Broadcasting Distributed Computing</PackageTags>
<!--<Summary>PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously</Summary>-->
<Description>PubNub is a Massively Scalable Web Push Service for Web and Mobile Games. This is a cloud-based service for broadcasting messages to thousands of web and mobile clients simultaneously</Description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
<Reference Include="Numbers, Version=1.8.2.0, Culture=neutral, PublicKeyToken=9cd62db60ea5554c, processorArchitecture=MSIL">
<HintPath>..\..\packages\PeterO.Numbers.1.8.2\lib\net40\Numbers.dll</HintPath>
</Reference>
<Reference Include="Pubnub, Version=6.6.0.0, Culture=neutral, PublicKeyToken=dc66f52ce6619f44, processorArchitecture=MSIL">
<HintPath>..\..\packages\Pubnub.6.6.0\lib\net48\Pubnub.dll</HintPath>
<Reference Include="Pubnub, Version=6.7.0.0, Culture=neutral, PublicKeyToken=dc66f52ce6619f44, processorArchitecture=MSIL">
<HintPath>..\..\packages\Pubnub.6.7.0\lib\net48\Pubnub.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
Expand Down
2 changes: 1 addition & 1 deletion src/Examples/PubnubApi.ConsoleExample/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<package id="PeterO.Cbor" version="4.5.2" targetFramework="net461" />
<package id="PeterO.Numbers" version="1.8.2" targetFramework="net461" />
<package id="PeterO.URIUtility" version="1.0.0" targetFramework="net461" />
<package id="Pubnub" version="6.6.0" targetFramework="net48" />
<package id="Pubnub" version="6.7.0" targetFramework="net48" />
<package id="System.Collections" version="4.0.11" targetFramework="net461" />
<package id="System.Diagnostics.Debug" version="4.0.11" targetFramework="net461" />
<package id="System.Globalization" version="4.0.11" targetFramework="net461" />
Expand Down

0 comments on commit d2f13c2

Please sign in to comment.