Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix listeners list inherit race of conditions #395

Merged
merged 1 commit into from
Jun 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions PubNub/Data/Managers/PNStateListener.m
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,14 @@ - (void)inheritStateFromListener:(PNStateListener *)listener {
return;
}

NSHashTable *messageListeners = [listener listenersCopyFrom:listener.messageListeners];
NSHashTable *presenceEventListeners = [listener listenersCopyFrom:listener.presenceEventListeners];
NSHashTable *stateListeners = [listener listenersCopyFrom:listener.stateListeners];

dispatch_async(self.resourceAccessQueue, ^{
self.messageListeners = [listener listenersCopyFrom:listener.messageListeners];
self.presenceEventListeners = [listener listenersCopyFrom:listener.presenceEventListeners];
self.stateListeners = [listener listenersCopyFrom:listener.stateListeners];
self.messageListeners = messageListeners;
self.presenceEventListeners = presenceEventListeners;
self.stateListeners = stateListeners;
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>creationDate</key>
<date>2019-05-16T07:36:48Z</date>
<date>2019-06-21T08:48:34Z</date>
<key>scenes</key>
<array>
<dict>
Expand All @@ -17,7 +17,7 @@
<key>HTTPShouldUsePipelining</key>
<false/>
<key>URL</key>
<string>https://ps.pndsn.com/v1/push/sub-key/rsub-c-00000000-0000-0000-0000-000000000000/devices/6652cff7f17536c86bc353527017741ec07a91699661abaf68c5977a83013091?uuid=322A70B3-F0EA-48CD-9BB0-D3F0F5DE996C&amp;instanceid=58EB05C9-9DE4-4118-B5D7-EE059FBF19A9&amp;add=1,2,3&amp;deviceid=3650F534-FC54-4EE8-884C-EF1B83188BB7&amp;pnsdk=PubNub-ObjC-iOS%2F4.8.7</string>
<string>https://ps.pndsn.com/v1/push/sub-key/rsub-c-00000000-0000-0000-0000-000000000000/devices/6652cff7f17536c86bc353527017741ec07a91699661abaf68c5977a83013091?uuid=322A70B3-F0EA-48CD-9BB0-D3F0F5DE996C&amp;instanceid=58EB05C9-9DE4-4118-B5D7-EE059FBF19A9&amp;add=1,2,3&amp;type=apns&amp;deviceid=3650F534-FC54-4EE8-884C-EF1B83188BB7&amp;pnsdk=PubNub-ObjC-iOS%2F4.8.9</string>
<key>allHTTPHeaderFields</key>
<dict>
<key>Accept</key>
Expand All @@ -27,18 +27,18 @@
<key>Connection</key>
<string>keep-alive</string>
<key>User-Agent</key>
<string>iPhone; CPU iPhone OS 12.1.0 Version</string>
<string>iPhone; CPU iPhone OS 12.2.0 Version</string>
</dict>
<key>allowsCellularAccess</key>
<true/>
<key>class</key>
<string>BKROriginalRequestFrame</string>
<key>creationDate</key>
<real>1557992208.3712611</real>
<real>1561106914.682342</real>
<key>timeoutInterval</key>
<real>60</real>
<key>uniqueIdentifier</key>
<string>1ED34BDE-6933-4DAC-A4A6-F9D8BA2143CB</string>
<string>0322C015-F510-4CB7-A312-39E35F959B4C</string>
</dict>
<dict>
<key>HTTPMethod</key>
Expand All @@ -48,38 +48,7 @@
<key>HTTPShouldUsePipelining</key>
<false/>
<key>URL</key>
<string>https://ps.pndsn.com/v1/push/sub-key/rsub-c-00000000-0000-0000-0000-000000000000/devices/6652cff7f17536c86bc353527017741ec07a91699661abaf68c5977a83013091?uuid=322A70B3-F0EA-48CD-9BB0-D3F0F5DE996C&amp;instanceid=58EB05C9-9DE4-4118-B5D7-EE059FBF19A9&amp;add=1,2,3&amp;deviceid=3650F534-FC54-4EE8-884C-EF1B83188BB7&amp;pnsdk=PubNub-ObjC-iOS%2F4.8.7</string>
<key>allHTTPHeaderFields</key>
<dict>
<key>Accept</key>
<string>*/*</string>
<key>Accept-Encoding</key>
<string>gzip,deflate</string>
<key>Connection</key>
<string>keep-alive</string>
<key>User-Agent</key>
<string>iPhone; CPU iPhone OS 12.1.0 Version</string>
</dict>
<key>allowsCellularAccess</key>
<true/>
<key>class</key>
<string>BKRCurrentRequestFrame</string>
<key>creationDate</key>
<real>1557992208.3715081</real>
<key>timeoutInterval</key>
<real>60</real>
<key>uniqueIdentifier</key>
<string>1ED34BDE-6933-4DAC-A4A6-F9D8BA2143CB</string>
</dict>
<dict>
<key>HTTPMethod</key>
<string>GET</string>
<key>HTTPShouldHandleCookies</key>
<true/>
<key>HTTPShouldUsePipelining</key>
<false/>
<key>URL</key>
<string>https://ps.pndsn.com/v1/push/sub-key/rsub-c-00000000-0000-0000-0000-000000000000/devices/6652cff7f17536c86bc353527017741ec07a91699661abaf68c5977a83013091?uuid=322A70B3-F0EA-48CD-9BB0-D3F0F5DE996C&amp;instanceid=58EB05C9-9DE4-4118-B5D7-EE059FBF19A9&amp;add=1,2,3&amp;deviceid=3650F534-FC54-4EE8-884C-EF1B83188BB7&amp;pnsdk=PubNub-ObjC-iOS%2F4.8.7</string>
<string>https://ps.pndsn.com/v1/push/sub-key/rsub-c-00000000-0000-0000-0000-000000000000/devices/6652cff7f17536c86bc353527017741ec07a91699661abaf68c5977a83013091?uuid=322A70B3-F0EA-48CD-9BB0-D3F0F5DE996C&amp;instanceid=58EB05C9-9DE4-4118-B5D7-EE059FBF19A9&amp;add=1,2,3&amp;type=apns&amp;deviceid=3650F534-FC54-4EE8-884C-EF1B83188BB7&amp;pnsdk=PubNub-ObjC-iOS%2F4.8.9</string>
<key>allHTTPHeaderFields</key>
<dict>
<key>Accept</key>
Expand All @@ -91,24 +60,24 @@
<key>Connection</key>
<string>keep-alive</string>
<key>User-Agent</key>
<string>iPhone; CPU iPhone OS 12.1.0 Version</string>
<string>iPhone; CPU iPhone OS 12.2.0 Version</string>
</dict>
<key>allowsCellularAccess</key>
<true/>
<key>class</key>
<string>BKRCurrentRequestFrame</string>
<key>creationDate</key>
<real>1557992208.3723049</real>
<real>1561106914.683235</real>
<key>timeoutInterval</key>
<real>60</real>
<key>uniqueIdentifier</key>
<string>1ED34BDE-6933-4DAC-A4A6-F9D8BA2143CB</string>
<string>0322C015-F510-4CB7-A312-39E35F959B4C</string>
</dict>
<dict>
<key>MIMEType</key>
<string>text/javascript</string>
<key>URL</key>
<string>https://ps.pndsn.com/v1/push/sub-key/rsub-c-00000000-0000-0000-0000-000000000000/devices/6652cff7f17536c86bc353527017741ec07a91699661abaf68c5977a83013091?uuid=322A70B3-F0EA-48CD-9BB0-D3F0F5DE996C&amp;instanceid=58EB05C9-9DE4-4118-B5D7-EE059FBF19A9&amp;add=1,2,3&amp;deviceid=3650F534-FC54-4EE8-884C-EF1B83188BB7&amp;pnsdk=PubNub-ObjC-iOS%2F4.8.7</string>
<string>https://ps.pndsn.com/v1/push/sub-key/rsub-c-00000000-0000-0000-0000-000000000000/devices/6652cff7f17536c86bc353527017741ec07a91699661abaf68c5977a83013091?uuid=322A70B3-F0EA-48CD-9BB0-D3F0F5DE996C&amp;instanceid=58EB05C9-9DE4-4118-B5D7-EE059FBF19A9&amp;add=1,2,3&amp;type=apns&amp;deviceid=3650F534-FC54-4EE8-884C-EF1B83188BB7&amp;pnsdk=PubNub-ObjC-iOS%2F4.8.9</string>
<key>allHeaderFields</key>
<dict>
<key>Accept-Ranges</key>
Expand All @@ -126,36 +95,34 @@
<key>Content-Length</key>
<string>24</string>
<key>Content-Type</key>
<string>text/javascript; charset="UTF-8"</string>
<string>text/javascript; charset=&quot;UTF-8&quot;</string>
<key>Date</key>
<string>Thu, 16 May 2019 07:36:48 GMT</string>
<string>Fri, 21 Jun 2019 08:48:35 GMT</string>
<key>Server</key>
<string>Pubnub</string>
</dict>
<key>class</key>
<string>BKRResponseFrame</string>
<key>creationDate</key>
<real>1557992208.6401081</real>
<real>1561106915.727996</real>
<key>statusCode</key>
<integer>200</integer>
<key>uniqueIdentifier</key>
<string>1ED34BDE-6933-4DAC-A4A6-F9D8BA2143CB</string>
<string>0322C015-F510-4CB7-A312-39E35F959B4C</string>
</dict>
<dict>
<key>class</key>
<string>BKRDataFrame</string>
<key>creationDate</key>
<real>1557992208.6401949</real>
<real>1561106915.72813</real>
<key>data</key>
<data>
WzEsICJNb2RpZmllZCBDaGFubmVscyJd
</data>
<data>WzEsICJNb2RpZmllZCBDaGFubmVscyJd</data>
<key>uniqueIdentifier</key>
<string>1ED34BDE-6933-4DAC-A4A6-F9D8BA2143CB</string>
<string>0322C015-F510-4CB7-A312-39E35F959B4C</string>
</dict>
</array>
<key>uniqueIdentifier</key>
<string>1ED34BDE-6933-4DAC-A4A6-F9D8BA2143CB</string>
<string>0322C015-F510-4CB7-A312-39E35F959B4C</string>
</dict>
</array>
<key>version</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>creationDate</key>
<date>2019-05-16T07:36:48Z</date>
<date>2019-06-21T08:48:35Z</date>
<key>scenes</key>
<array/>
<key>version</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>creationDate</key>
<date>2019-05-16T07:36:48Z</date>
<date>2019-06-21T08:48:35Z</date>
<key>scenes</key>
<array/>
<key>version</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>creationDate</key>
<date>2019-05-16T07:36:48Z</date>
<date>2019-06-21T08:48:35Z</date>
<key>scenes</key>
<array>
<dict>
Expand All @@ -17,7 +17,7 @@
<key>HTTPShouldUsePipelining</key>
<false/>
<key>URL</key>
<string>https://ps.pndsn.com/v1/push/sub-key/rsub-c-00000000-0000-0000-0000-000000000000/devices/6652cff7f17536c86bc353527017741ec07a91699661abaf68c5977a83013091?uuid=322A70B3-F0EA-48CD-9BB0-D3F0F5DE996C&amp;instanceid=58EB05C9-9DE4-4118-B5D7-EE059FBF19A9&amp;deviceid=3650F534-FC54-4EE8-884C-EF1B83188BB7&amp;pnsdk=PubNub-ObjC-iOS%2F4.8.7</string>
<string>https://ps.pndsn.com/v1/push/sub-key/rsub-c-00000000-0000-0000-0000-000000000000/devices/6652cff7f17536c86bc353527017741ec07a91699661abaf68c5977a83013091?uuid=322A70B3-F0EA-48CD-9BB0-D3F0F5DE996C&amp;instanceid=58EB05C9-9DE4-4118-B5D7-EE059FBF19A9&amp;deviceid=3650F534-FC54-4EE8-884C-EF1B83188BB7&amp;type=apns&amp;pnsdk=PubNub-ObjC-iOS%2F4.8.9</string>
<key>allHTTPHeaderFields</key>
<dict>
<key>Accept</key>
Expand All @@ -27,18 +27,18 @@
<key>Connection</key>
<string>keep-alive</string>
<key>User-Agent</key>
<string>iPhone; CPU iPhone OS 12.1.0 Version</string>
<string>iPhone; CPU iPhone OS 12.2.0 Version</string>
</dict>
<key>allowsCellularAccess</key>
<true/>
<key>class</key>
<string>BKROriginalRequestFrame</string>
<key>creationDate</key>
<real>1557992208.6883512</real>
<real>1561106915.893078</real>
<key>timeoutInterval</key>
<real>60</real>
<key>uniqueIdentifier</key>
<string>FEA1B709-A0ED-45B6-8D50-CEC83B2902DC</string>
<string>1928D191-2754-4EFC-B22D-ECF95F6993C7</string>
</dict>
<dict>
<key>HTTPMethod</key>
Expand All @@ -48,7 +48,38 @@
<key>HTTPShouldUsePipelining</key>
<false/>
<key>URL</key>
<string>https://ps.pndsn.com/v1/push/sub-key/rsub-c-00000000-0000-0000-0000-000000000000/devices/6652cff7f17536c86bc353527017741ec07a91699661abaf68c5977a83013091?uuid=322A70B3-F0EA-48CD-9BB0-D3F0F5DE996C&amp;instanceid=58EB05C9-9DE4-4118-B5D7-EE059FBF19A9&amp;deviceid=3650F534-FC54-4EE8-884C-EF1B83188BB7&amp;pnsdk=PubNub-ObjC-iOS%2F4.8.7</string>
<string>https://ps.pndsn.com/v1/push/sub-key/rsub-c-00000000-0000-0000-0000-000000000000/devices/6652cff7f17536c86bc353527017741ec07a91699661abaf68c5977a83013091?uuid=322A70B3-F0EA-48CD-9BB0-D3F0F5DE996C&amp;instanceid=58EB05C9-9DE4-4118-B5D7-EE059FBF19A9&amp;deviceid=3650F534-FC54-4EE8-884C-EF1B83188BB7&amp;type=apns&amp;pnsdk=PubNub-ObjC-iOS%2F4.8.9</string>
<key>allHTTPHeaderFields</key>
<dict>
<key>Accept</key>
<string>*/*</string>
<key>Accept-Encoding</key>
<string>gzip,deflate</string>
<key>Connection</key>
<string>keep-alive</string>
<key>User-Agent</key>
<string>iPhone; CPU iPhone OS 12.2.0 Version</string>
</dict>
<key>allowsCellularAccess</key>
<true/>
<key>class</key>
<string>BKRCurrentRequestFrame</string>
<key>creationDate</key>
<real>1561106915.89315</real>
<key>timeoutInterval</key>
<real>60</real>
<key>uniqueIdentifier</key>
<string>1928D191-2754-4EFC-B22D-ECF95F6993C7</string>
</dict>
<dict>
<key>HTTPMethod</key>
<string>GET</string>
<key>HTTPShouldHandleCookies</key>
<true/>
<key>HTTPShouldUsePipelining</key>
<false/>
<key>URL</key>
<string>https://ps.pndsn.com/v1/push/sub-key/rsub-c-00000000-0000-0000-0000-000000000000/devices/6652cff7f17536c86bc353527017741ec07a91699661abaf68c5977a83013091?uuid=322A70B3-F0EA-48CD-9BB0-D3F0F5DE996C&amp;instanceid=58EB05C9-9DE4-4118-B5D7-EE059FBF19A9&amp;deviceid=3650F534-FC54-4EE8-884C-EF1B83188BB7&amp;type=apns&amp;pnsdk=PubNub-ObjC-iOS%2F4.8.9</string>
<key>allHTTPHeaderFields</key>
<dict>
<key>Accept</key>
Expand All @@ -60,24 +91,24 @@
<key>Connection</key>
<string>keep-alive</string>
<key>User-Agent</key>
<string>iPhone; CPU iPhone OS 12.1.0 Version</string>
<string>iPhone; CPU iPhone OS 12.2.0 Version</string>
</dict>
<key>allowsCellularAccess</key>
<true/>
<key>class</key>
<string>BKRCurrentRequestFrame</string>
<key>creationDate</key>
<real>1557992208.688854</real>
<real>1561106915.893543</real>
<key>timeoutInterval</key>
<real>60</real>
<key>uniqueIdentifier</key>
<string>FEA1B709-A0ED-45B6-8D50-CEC83B2902DC</string>
<string>1928D191-2754-4EFC-B22D-ECF95F6993C7</string>
</dict>
<dict>
<key>MIMEType</key>
<string>text/javascript</string>
<key>URL</key>
<string>https://ps.pndsn.com/v1/push/sub-key/rsub-c-00000000-0000-0000-0000-000000000000/devices/6652cff7f17536c86bc353527017741ec07a91699661abaf68c5977a83013091?uuid=322A70B3-F0EA-48CD-9BB0-D3F0F5DE996C&amp;instanceid=58EB05C9-9DE4-4118-B5D7-EE059FBF19A9&amp;deviceid=3650F534-FC54-4EE8-884C-EF1B83188BB7&amp;pnsdk=PubNub-ObjC-iOS%2F4.8.7</string>
<string>https://ps.pndsn.com/v1/push/sub-key/rsub-c-00000000-0000-0000-0000-000000000000/devices/6652cff7f17536c86bc353527017741ec07a91699661abaf68c5977a83013091?uuid=322A70B3-F0EA-48CD-9BB0-D3F0F5DE996C&amp;instanceid=58EB05C9-9DE4-4118-B5D7-EE059FBF19A9&amp;deviceid=3650F534-FC54-4EE8-884C-EF1B83188BB7&amp;type=apns&amp;pnsdk=PubNub-ObjC-iOS%2F4.8.9</string>
<key>allHeaderFields</key>
<dict>
<key>Accept-Ranges</key>
Expand All @@ -95,36 +126,34 @@
<key>Content-Length</key>
<string>15</string>
<key>Content-Type</key>
<string>text/javascript; charset="UTF-8"</string>
<string>text/javascript; charset=&quot;UTF-8&quot;</string>
<key>Date</key>
<string>Thu, 16 May 2019 07:36:48 GMT</string>
<string>Fri, 21 Jun 2019 08:48:36 GMT</string>
<key>Server</key>
<string>Pubnub</string>
</dict>
<key>class</key>
<string>BKRResponseFrame</string>
<key>creationDate</key>
<real>1557992208.9095809</real>
<real>1561106916.853613</real>
<key>statusCode</key>
<integer>200</integer>
<key>uniqueIdentifier</key>
<string>FEA1B709-A0ED-45B6-8D50-CEC83B2902DC</string>
<string>1928D191-2754-4EFC-B22D-ECF95F6993C7</string>
</dict>
<dict>
<key>class</key>
<string>BKRDataFrame</string>
<key>creationDate</key>
<real>1557992208.9096398</real>
<real>1561106916.853642</real>
<key>data</key>
<data>
WyIxIiwgIjMiLCAiMiJd
</data>
<data>WyIxIiwgIjMiLCAiMiJd</data>
<key>uniqueIdentifier</key>
<string>FEA1B709-A0ED-45B6-8D50-CEC83B2902DC</string>
<string>1928D191-2754-4EFC-B22D-ECF95F6993C7</string>
</dict>
</array>
<key>uniqueIdentifier</key>
<string>FEA1B709-A0ED-45B6-8D50-CEC83B2902DC</string>
<string>1928D191-2754-4EFC-B22D-ECF95F6993C7</string>
</dict>
</array>
<key>version</key>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>creationDate</key>
<date>2019-05-16T07:36:48Z</date>
<date>2019-06-21T08:48:36Z</date>
<key>scenes</key>
<array/>
<key>version</key>
Expand Down
Loading