File tree 2 files changed +21
-7
lines changed
2 files changed +21
-7
lines changed Original file line number Diff line number Diff line change @@ -67,13 +67,7 @@ class OPENDHT_PUBLIC DhtProxyClient final : public DhtInterface {
67
67
68
68
void setHeaderFields (http::Request& request);
69
69
70
- virtual void setPushNotificationToken (const std::string& token) override {
71
- #ifdef OPENDHT_PUSH_NOTIFICATIONS
72
- deviceKey_ = token;
73
- #else
74
- (void ) token;
75
- #endif
76
- }
70
+ virtual void setPushNotificationToken (const std::string& token) override ;
77
71
78
72
virtual void setPushNotificationTopic (const std::string& topic) override {
79
73
#ifdef OPENDHT_PUSH_NOTIFICATIONS
Original file line number Diff line number Diff line change @@ -1394,4 +1394,24 @@ DhtProxyClient::fillBody(bool resubscribe)
1394
1394
}
1395
1395
#endif // OPENDHT_PUSH_NOTIFICATIONS
1396
1396
1397
+ void
1398
+ DhtProxyClient::setPushNotificationToken ([[maybe_unused]] const std::string& token) {
1399
+ #ifdef OPENDHT_PUSH_NOTIFICATIONS
1400
+ std::unique_lock<std::mutex> l (lockCurrentProxyInfos_);
1401
+ if (deviceKey_ != token) {
1402
+ deviceKey_ = token;
1403
+ if (statusIpv4_ == NodeStatus::Connected || statusIpv6_ == NodeStatus::Connected) {
1404
+ if (logger_)
1405
+ logger_->d (" [proxy:client] [push] token changed, resubscribing" );
1406
+ for (auto & search : searches_) {
1407
+ for (auto & listener : search.second .listeners ) {
1408
+ resubscribe (search.first , listener.first , listener.second );
1409
+ }
1410
+ }
1411
+ }
1412
+ }
1413
+ #endif
1414
+ }
1415
+
1416
+
1397
1417
} // namespace dht
You can’t perform that action at this time.
0 commit comments