##// END OF EJS Templates
Improve synchro robustness.
perrinel -
r815:e8f1dd84704e
parent child
Show More
@@ -71,8 +71,8 QUuid VariableAcquisitionWorker::pushVariableRequest(QUuid varRequestId, QUuid v
71
71
72 // Request creation
72 // Request creation
73 auto acqRequest = AcquisitionRequest{};
73 auto acqRequest = AcquisitionRequest{};
74 qCInfo(LOG_VariableAcquisitionWorker()) << tr("TpushVariableRequest ") << vIdentifier
74 qCDebug(LOG_VariableAcquisitionWorker()) << tr("PushVariableRequest ") << vIdentifier
75 << varRequestId;
75 << varRequestId;
76 acqRequest.m_VarRequestId = varRequestId;
76 acqRequest.m_VarRequestId = varRequestId;
77 acqRequest.m_vIdentifier = vIdentifier;
77 acqRequest.m_vIdentifier = vIdentifier;
78 acqRequest.m_DataProviderParameters = parameters;
78 acqRequest.m_DataProviderParameters = parameters;
@@ -101,7 +101,7 QUuid VariableAcquisitionWorker::pushVariableRequest(QUuid varRequestId, QUuid v
101 impl->unlock();
101 impl->unlock();
102
102
103 // remove old acqIdentifier from the worker
103 // remove old acqIdentifier from the worker
104 impl->cancelVarRequest(oldAcqId);
104 impl->cancelVarRequest(varRequestIdCanceled);
105 // impl->m_AcqIdentifierToAcqRequestMap.erase(oldAcqId);
105 // impl->m_AcqIdentifierToAcqRequestMap.erase(oldAcqId);
106 }
106 }
107 else {
107 else {
@@ -343,7 +343,8 void VariableAcquisitionWorker::VariableAcquisitionWorkerPrivate::updateToNextRe
343 void VariableAcquisitionWorker::VariableAcquisitionWorkerPrivate::cancelVarRequest(
343 void VariableAcquisitionWorker::VariableAcquisitionWorkerPrivate::cancelVarRequest(
344 QUuid varRequestId)
344 QUuid varRequestId)
345 {
345 {
346 qInfo() << "VariableAcquisitionWorkerPrivate::cancelVarRequest 0";
346 qCCritical(LOG_VariableAcquisitionWorker())
347 << "VariableAcquisitionWorkerPrivate::cancelVarRequest 0";
347 lockRead();
348 lockRead();
348 // get all AcqIdentifier in link with varRequestId
349 // get all AcqIdentifier in link with varRequestId
349 QVector<QUuid> acqIdsToRm;
350 QVector<QUuid> acqIdsToRm;
@@ -359,29 +360,35 void VariableAcquisitionWorker::VariableAcquisitionWorkerPrivate::cancelVarReque
359 for (auto acqId : acqIdsToRm) {
360 for (auto acqId : acqIdsToRm) {
360 removeAcqRequest(acqId);
361 removeAcqRequest(acqId);
361 }
362 }
362 qInfo() << "VariableAcquisitionWorkerPrivate::cancelVarRequest end";
363 qCCritical(LOG_VariableAcquisitionWorker())
364 << "VariableAcquisitionWorkerPrivate::cancelVarRequest end";
363 }
365 }
364
366
365 void VariableAcquisitionWorker::VariableAcquisitionWorkerPrivate::removeAcqRequest(
367 void VariableAcquisitionWorker::VariableAcquisitionWorkerPrivate::removeAcqRequest(
366 QUuid acqRequestId)
368 QUuid acqRequestId)
367 {
369 {
368 qInfo() << "VariableAcquisitionWorkerPrivate::removeAcqRequest 0";
370 qCDebug(LOG_VariableAcquisitionWorker())
371 << "VariableAcquisitionWorkerPrivate::removeAcqRequest 0";
369 QUuid vIdentifier;
372 QUuid vIdentifier;
370 std::shared_ptr<IDataProvider> provider;
373 std::shared_ptr<IDataProvider> provider;
371 lockRead();
374 lockRead();
372 auto acqIt = m_AcqIdentifierToAcqRequestMap.find(acqRequestId);
375 auto acqIt = m_AcqIdentifierToAcqRequestMap.find(acqRequestId);
373 qInfo() << "VariableAcquisitionWorkerPrivate::removeAcqRequest 1";
376 qCDebug(LOG_VariableAcquisitionWorker())
377 << "VariableAcquisitionWorkerPrivate::removeAcqRequest 1";
374 if (acqIt != m_AcqIdentifierToAcqRequestMap.cend()) {
378 if (acqIt != m_AcqIdentifierToAcqRequestMap.cend()) {
375 vIdentifier = acqIt->second.m_vIdentifier;
379 vIdentifier = acqIt->second.m_vIdentifier;
376 provider = acqIt->second.m_Provider;
380 provider = acqIt->second.m_Provider;
377
381
378 qInfo() << "VariableAcquisitionWorkerPrivate::removeAcqRequest 2";
382 qCDebug(LOG_VariableAcquisitionWorker())
383 << "VariableAcquisitionWorkerPrivate::removeAcqRequest 2";
379 auto it = m_VIdentifierToCurrrentAcqIdNextIdPairMap.find(vIdentifier);
384 auto it = m_VIdentifierToCurrrentAcqIdNextIdPairMap.find(vIdentifier);
380 if (it != m_VIdentifierToCurrrentAcqIdNextIdPairMap.cend()) {
385 if (it != m_VIdentifierToCurrrentAcqIdNextIdPairMap.cend()) {
381 qInfo() << "VariableAcquisitionWorkerPrivate::removeAcqRequest 3";
386 qCDebug(LOG_VariableAcquisitionWorker())
387 << "VariableAcquisitionWorkerPrivate::removeAcqRequest 3";
382 if (it->second.first == acqRequestId) {
388 if (it->second.first == acqRequestId) {
383 // acqRequest is currently running -> let's aborting it
389 // acqRequest is currently running -> let's aborting it
384 qInfo() << "VariableAcquisitionWorkerPrivate::removeAcqRequest 4";
390 qCDebug(LOG_VariableAcquisitionWorker())
391 << "VariableAcquisitionWorkerPrivate::removeAcqRequest 4";
385 unlock();
392 unlock();
386
393
387 // Remove the current request from the worker
394 // Remove the current request from the worker
@@ -389,34 +396,41 void VariableAcquisitionWorker::VariableAcquisitionWorkerPrivate::removeAcqReque
389
396
390 // notify the request aborting to the provider
397 // notify the request aborting to the provider
391 provider->requestDataAborting(acqRequestId);
398 provider->requestDataAborting(acqRequestId);
392 qInfo() << "VariableAcquisitionWorkerPrivate::removeAcqRequest 5";
399 qCDebug(LOG_VariableAcquisitionWorker())
400 << "VariableAcquisitionWorkerPrivate::removeAcqRequest 5";
393 }
401 }
394 else if (it->second.second == acqRequestId) {
402 else if (it->second.second == acqRequestId) {
395 it->second.second = QUuid();
403 it->second.second = QUuid();
396 qInfo() << "VariableAcquisitionWorkerPrivate::removeAcqRequest 6";
404 qCDebug(LOG_VariableAcquisitionWorker())
405 << "VariableAcquisitionWorkerPrivate::removeAcqRequest 6";
397 unlock();
406 unlock();
398 }
407 }
399 else {
408 else {
400 qInfo() << "VariableAcquisitionWorkerPrivate::removeAcqRequest 7";
409 qCDebug(LOG_VariableAcquisitionWorker())
410 << "VariableAcquisitionWorkerPrivate::removeAcqRequest 7";
401 unlock();
411 unlock();
402 }
412 }
403 }
413 }
404 else {
414 else {
405 qInfo() << "VariableAcquisitionWorkerPrivate::removeAcqRequest 8";
415 qCDebug(LOG_VariableAcquisitionWorker())
416 << "VariableAcquisitionWorkerPrivate::removeAcqRequest 8";
406 unlock();
417 unlock();
407 }
418 }
408 }
419 }
409 else {
420 else {
410 qInfo() << "VariableAcquisitionWorkerPrivate::removeAcqRequest 9";
421 qCDebug(LOG_VariableAcquisitionWorker())
422 << "VariableAcquisitionWorkerPrivate::removeAcqRequest 9";
411 unlock();
423 unlock();
412 }
424 }
413
425
414 qInfo() << "VariableAcquisitionWorkerPrivate::removeAcqRequest 10";
426 qCDebug(LOG_VariableAcquisitionWorker())
427 << "VariableAcquisitionWorkerPrivate::removeAcqRequest 10";
415 lockWrite();
428 lockWrite();
416
429
417 m_AcqIdentifierToAcqDataPacketVectorMap.erase(acqRequestId);
430 m_AcqIdentifierToAcqDataPacketVectorMap.erase(acqRequestId);
418 m_AcqIdentifierToAcqRequestMap.erase(acqRequestId);
431 m_AcqIdentifierToAcqRequestMap.erase(acqRequestId);
419
432
420 unlock();
433 unlock();
421 qInfo() << "VariableAcquisitionWorkerPrivate::removeAcqRequest 11";
434 qCDebug(LOG_VariableAcquisitionWorker())
435 << "VariableAcquisitionWorkerPrivate::removeAcqRequest 11";
422 }
436 }
@@ -554,23 +554,23 AcquisitionZoomType VariableController::getZoomType(const SqpRange &range, const
554 // t1.m_TStart <= t2.m_TStart && t2.m_TEnd <= t1.m_TEnd
554 // t1.m_TStart <= t2.m_TStart && t2.m_TEnd <= t1.m_TEnd
555 auto zoomType = AcquisitionZoomType::Unknown;
555 auto zoomType = AcquisitionZoomType::Unknown;
556 if (range.m_TStart <= oldRange.m_TStart && oldRange.m_TEnd <= range.m_TEnd) {
556 if (range.m_TStart <= oldRange.m_TStart && oldRange.m_TEnd <= range.m_TEnd) {
557 qCCritical(LOG_VariableController()) << "zoomtype: ZoomOut";
557 qCDebug(LOG_VariableController()) << "zoomtype: ZoomOut";
558 zoomType = AcquisitionZoomType::ZoomOut;
558 zoomType = AcquisitionZoomType::ZoomOut;
559 }
559 }
560 else if (range.m_TStart > oldRange.m_TStart && range.m_TEnd > oldRange.m_TEnd) {
560 else if (range.m_TStart > oldRange.m_TStart && range.m_TEnd > oldRange.m_TEnd) {
561 qCCritical(LOG_VariableController()) << "zoomtype: PanRight";
561 qCDebug(LOG_VariableController()) << "zoomtype: PanRight";
562 zoomType = AcquisitionZoomType::PanRight;
562 zoomType = AcquisitionZoomType::PanRight;
563 }
563 }
564 else if (range.m_TStart < oldRange.m_TStart && range.m_TEnd < oldRange.m_TEnd) {
564 else if (range.m_TStart < oldRange.m_TStart && range.m_TEnd < oldRange.m_TEnd) {
565 qCCritical(LOG_VariableController()) << "zoomtype: PanLeft";
565 qCDebug(LOG_VariableController()) << "zoomtype: PanLeft";
566 zoomType = AcquisitionZoomType::PanLeft;
566 zoomType = AcquisitionZoomType::PanLeft;
567 }
567 }
568 else if (range.m_TStart > oldRange.m_TStart && oldRange.m_TEnd > range.m_TEnd) {
568 else if (range.m_TStart > oldRange.m_TStart && oldRange.m_TEnd > range.m_TEnd) {
569 qCCritical(LOG_VariableController()) << "zoomtype: ZoomIn";
569 qCDebug(LOG_VariableController()) << "zoomtype: ZoomIn";
570 zoomType = AcquisitionZoomType::ZoomIn;
570 zoomType = AcquisitionZoomType::ZoomIn;
571 }
571 }
572 else {
572 else {
573 qCCritical(LOG_VariableController()) << "getZoomType: Unknown type detected";
573 qCDebug(LOG_VariableController()) << "getZoomType: Unknown type detected";
574 }
574 }
575 return zoomType;
575 return zoomType;
576 }
576 }
@@ -768,7 +768,7 QUuid VariableController::VariableControllerPrivate::acceptVariableRequest(
768
768
769 varRequestIdQueue.pop_front();
769 varRequestIdQueue.pop_front();
770 if (varRequestIdQueue.empty()) {
770 if (varRequestIdQueue.empty()) {
771 qCCritical(LOG_VariableController())
771 qCDebug(LOG_VariableController())
772 << tr("TORM Erase REQUEST because it has been accepted") << varId;
772 << tr("TORM Erase REQUEST because it has been accepted") << varId;
773 m_VarIdToVarRequestIdQueueMap.erase(varId);
773 m_VarIdToVarRequestIdQueueMap.erase(varId);
774 }
774 }
General Comments 0
You need to be logged in to leave comments. Login now