Showing the changes to Source/Libraries/TimeSeriesPlatformLibrary/Samples/AdvancedPublish.cpp (1 of 4 files). Show all
Unified · Split
| @@ -337,37 +337,37 @@ void HandleTemporalSubscriptionRequested(DataPublisher* source, const Subscriber · 336 unmodified lines | |||
| 337 | { | 337 | { |
| 338 | cout << "Client \"" << connection->GetConnectionID() << "\" with subscriber ID " << ToString(connection->GetSubscriberID()) << " has requested a temporal subscription starting at " << ToString(connection->GetStartTimeConstraint()) << endl << endl; | 338 | cout << "Client \"" << connection->GetConnectionID() << "\" with subscriber ID " << ToString(connection->GetSubscriberID()) << " has requested a temporal subscription starting at " << ToString(connection->GetStartTimeConstraint()) << endl << endl; |
| 339 | 339 | ||
| 340 | TemporalSubscriberPtr temporalSubscription = NewSharedPtr<TemporalSubscriber>(connection, [](const GSF::Guid& subscriberID) | 340 | TemporalSubscriberPtr temporalSubscription = NewSharedPtr<TemporalSubscriber>(connection, [](const GSF::Guid& instanceID) |
| 341 | { | 341 | { |
| 342 | Thread([subscriberID]{ | 342 | Thread([instanceID]{ |
| 343 | TemporalSubscriptionsLock.lock(); | 343 | TemporalSubscriptionsLock.lock(); |
| 344 | 344 | ||
| 345 | if (TemporalSubscriptions.find(subscriberID) != TemporalSubscriptions.end()) | 345 | if (TemporalSubscriptions.find(instanceID) != TemporalSubscriptions.end()) |
| 346 | TemporalSubscriptions.erase(subscriberID); | 346 | TemporalSubscriptions.erase(instanceID); |
| 347 | 347 | ||
| 348 | TemporalSubscriptionsLock.unlock(); | 348 | TemporalSubscriptionsLock.unlock(); |
| 349 | }); | 349 | }); |
| 350 | }); | 350 | }); |
| 351 | 351 | ||
| 352 | TemporalSubscriptionsLock.lock(); | 352 | TemporalSubscriptionsLock.lock(); |
| 353 | TemporalSubscriptions.insert_or_assign(connection->GetSubscriberID(), temporalSubscription); | 353 | TemporalSubscriptions.insert_or_assign(connection->GetInstanceID(), temporalSubscription); |
| 354 | TemporalSubscriptionsLock.unlock(); | 354 | TemporalSubscriptionsLock.unlock(); |
| 355 | } | 355 | } |
| 356 | 356 | ||
| 357 | void HandleProcessingIntervalChangeRequested(DataPublisher* source, const SubscriberConnectionPtr& connection) | 357 | void HandleProcessingIntervalChangeRequested(DataPublisher* source, const SubscriberConnectionPtr& connection) |
| 358 | { | 358 | { |
| 359 | static const TemporalSubscriberPtr nullTemporalSubscription = nullptr; | 359 | static const TemporalSubscriberPtr nullTemporalSubscription = nullptr; |
| 360 | const GSF::Guid& subscriberID = connection->GetSubscriberID(); | 360 | const GSF::Guid& instanceID = connection->GetInstanceID(); |
| 361 | const int32_t processingInterval = connection->GetProcessingInterval(); | 361 | const int32_t processingInterval = connection->GetProcessingInterval(); |
| 362 | TemporalSubscriberPtr temporalSubscription; | 362 | TemporalSubscriberPtr temporalSubscription; |
| 363 | 363 | ||
| 364 | TemporalSubscriptionsLock.lock(); | 364 | TemporalSubscriptionsLock.lock(); |
| 365 | 365 | ||
| 366 | if (TryGetValue(TemporalSubscriptions, subscriberID, temporalSubscription, nullTemporalSubscription)) | 366 | if (TryGetValue(TemporalSubscriptions, instanceID, temporalSubscription, nullTemporalSubscription)) |
| 367 | temporalSubscription->SetProcessingInterval(processingInterval); | 367 | temporalSubscription->SetProcessingInterval(processingInterval); |
| 368 | 368 | ||
| 369 | TemporalSubscriptionsLock.unlock(); | 369 | TemporalSubscriptionsLock.unlock(); |
| 370 | 370 | ||
| 371 | if (temporalSubscription != nullTemporalSubscription) | 371 | if (temporalSubscription != nullTemporalSubscription) |
| 372 | cout << "Client \"" << connection->GetConnectionID() << "\" with subscriber ID " << ToString(subscriberID) << " has requested to change its temporal processing interval to " << ToString(processingInterval) << "ms" << endl << endl; | 372 | cout << "Client \"" << connection->GetConnectionID() << "\" with subscriber ID " << ToString(connection->GetSubscriberID()) << " has requested to change its temporal processing interval to " << ToString(processingInterval) << "ms" << endl << endl; |
| 373 | } | 373 | } |