Github user phrocker commented on a diff in the pull request:
https://github.com/apache/nifi-minifi-cpp/pull/346#discussion_r191487153
--- Diff: libminifi/src/controllers/NetworkPrioritizerService.cpp ---
@@ -65,33 +65,38 @@ void NetworkPrioritizerService::yield() {
/**
* If not an intersecting operation we will attempt to locate the highest
priority interface available.
*/
-io::NetworkInterface &&NetworkPrioritizerService::getInterface(uint32_t
size = 0) {
+io::NetworkInterface NetworkPrioritizerService::getInterface(uint32_t size
= 0) {
std::vector<std::string> controllers;
+ std::string ifc = "";
if (!network_controllers_.empty()) {
if (sufficient_tokens(size) && size < max_payload_) {
controllers.insert(std::end(controllers),
std::begin(network_controllers_), std::end(network_controllers_));
}
}
if (!controllers.empty()) {
- auto ifc = get_nearest_interface(controllers);
+ ifc = get_nearest_interface(controllers);
if (!ifc.empty()) {
reduce_tokens(size);
- return std::move(io::NetworkInterface(ifc, shared_from_this()));
+ io::NetworkInterface newifc(ifc, shared_from_this());
+ return newifc;
--- End diff --
That caused issue on one distro I tested in regards to the transient
string. the string was being elided causing an access an error later. In this
case the optimization didn't happen. It seems to be specific to that U18
compiler, so I took this route and this avoided the problem with valgrind
verification.
---