Mercurial > hg > orthanc-transfers
comparison Plugin/Plugin.cpp @ 55:b09adb6aa199
new PeerConnectivityTimeout configuration
author | Alain Mazy <am@osimis.io> |
---|---|
date | Mon, 06 Feb 2023 09:17:36 +0100 |
parents | f4e828607f02 |
children | 3f43bfbea00e |
comparison
equal
deleted
inserted
replaced
54:5915547fa6f2 | 55:b09adb6aa199 |
---|---|
577 return; | 577 return; |
578 } | 578 } |
579 | 579 |
580 OrthancPlugins::DetectTransferPlugin::Result detection; | 580 OrthancPlugins::DetectTransferPlugin::Result detection; |
581 OrthancPlugins::DetectTransferPlugin::Apply | 581 OrthancPlugins::DetectTransferPlugin::Apply |
582 (detection, context.GetThreadsCount(), 2 /* timeout */); | 582 (detection, context.GetThreadsCount(), context.GetPeerConnectivityTimeout()); |
583 | 583 |
584 Json::Value result = Json::objectValue; | 584 Json::Value result = Json::objectValue; |
585 | 585 |
586 OrthancPlugins::OrthancPeers peers; | 586 OrthancPlugins::OrthancPeers peers; |
587 | 587 |
647 size_t threadsCount = 4; | 647 size_t threadsCount = 4; |
648 size_t targetBucketSize = 4096; // In KB | 648 size_t targetBucketSize = 4096; // In KB |
649 size_t maxPushTransactions = 4; | 649 size_t maxPushTransactions = 4; |
650 size_t memoryCacheSize = 512; // In MB | 650 size_t memoryCacheSize = 512; // In MB |
651 unsigned int maxHttpRetries = 0; | 651 unsigned int maxHttpRetries = 0; |
652 unsigned int peerConnectivityTimeout = 2; | |
652 | 653 |
653 { | 654 { |
654 OrthancPlugins::OrthancConfiguration config; | 655 OrthancPlugins::OrthancConfiguration config; |
655 | 656 |
656 if (config.IsSection(KEY_PLUGIN_CONFIGURATION)) | 657 if (config.IsSection(KEY_PLUGIN_CONFIGURATION)) |
661 threadsCount = plugin.GetUnsignedIntegerValue("Threads", threadsCount); | 662 threadsCount = plugin.GetUnsignedIntegerValue("Threads", threadsCount); |
662 targetBucketSize = plugin.GetUnsignedIntegerValue("BucketSize", targetBucketSize); | 663 targetBucketSize = plugin.GetUnsignedIntegerValue("BucketSize", targetBucketSize); |
663 memoryCacheSize = plugin.GetUnsignedIntegerValue("CacheSize", memoryCacheSize); | 664 memoryCacheSize = plugin.GetUnsignedIntegerValue("CacheSize", memoryCacheSize); |
664 maxPushTransactions = plugin.GetUnsignedIntegerValue("MaxPushTransactions", maxPushTransactions); | 665 maxPushTransactions = plugin.GetUnsignedIntegerValue("MaxPushTransactions", maxPushTransactions); |
665 maxHttpRetries = plugin.GetUnsignedIntegerValue("MaxHttpRetries", maxHttpRetries); | 666 maxHttpRetries = plugin.GetUnsignedIntegerValue("MaxHttpRetries", maxHttpRetries); |
667 peerConnectivityTimeout = plugin.GetUnsignedIntegerValue("PeerConnectivityTimeout", peerConnectivityTimeout); | |
666 } | 668 } |
667 } | 669 } |
668 | 670 |
669 OrthancPlugins::PluginContext::Initialize(threadsCount, targetBucketSize * KB, maxPushTransactions, | 671 OrthancPlugins::PluginContext::Initialize(threadsCount, targetBucketSize * KB, maxPushTransactions, |
670 memoryCacheSize * MB, maxHttpRetries); | 672 memoryCacheSize * MB, maxHttpRetries, peerConnectivityTimeout); |
671 | 673 |
672 OrthancPlugins::RegisterRestCallback<ServeChunks> | 674 OrthancPlugins::RegisterRestCallback<ServeChunks> |
673 (std::string(URI_CHUNKS) + "/([.0-9a-f-]+)", true); | 675 (std::string(URI_CHUNKS) + "/([.0-9a-f-]+)", true); |
674 | 676 |
675 OrthancPlugins::RegisterRestCallback<LookupInstances> | 677 OrthancPlugins::RegisterRestCallback<LookupInstances> |