| 382 | } |
| 383 | |
| 384 | std::shared_ptr<Connectable> Processor::pickIncomingConnection() { |
| 385 | std::lock_guard<std::mutex> rel_guard(relationship_mutex_); |
| 386 | |
| 387 | auto beginIt = incoming_connections_Iter; |
| 388 | std::shared_ptr<Connectable> inConn; |
| 389 | do { |
| 390 | inConn = getNextIncomingConnectionImpl(rel_guard); |
| 391 | auto connection = std::dynamic_pointer_cast<Connection>(inConn); |
| 392 | if (!connection) { |
| 393 | continue; |
| 394 | } |
| 395 | if (partOfCycle(connection) && connection->isFull()) { |
| 396 | return inConn; |
| 397 | } |
| 398 | } while (incoming_connections_Iter != beginIt); |
| 399 | |
| 400 | // we did not find a preferred connection |
| 401 | return getNextIncomingConnectionImpl(rel_guard); |
| 402 | } |
| 403 | |
| 404 | } // namespace core |
| 405 | } // namespace minifi |