| 2678 | // Sends a message to the connected framework. |
| 2679 | template <typename Message> |
| 2680 | void Framework::send(const Message& message) |
| 2681 | { |
| 2682 | metrics.incrementEvent(message); |
| 2683 | |
| 2684 | if (!connected()) { |
| 2685 | LOG(WARNING) << "Master attempting to send message to disconnected" |
| 2686 | << " framework " << *this; |
| 2687 | |
| 2688 | // NOTE: We proceed here without returning to support the case where a |
| 2689 | // "disconnected" framework is still talking to the master and the master |
| 2690 | // wants to shut it down by sending a `FrameworkErrorMessage`. This can |
| 2691 | // occur in a one-way network partition where the master -> framework link |
| 2692 | // is broken but the framework -> master link remains intact. Note that we |
| 2693 | // have no periodic heartbeats between the master and pid-based schedulers. |
| 2694 | // |
| 2695 | // TODO(chhsiao): Update the `FrameworkErrorMessage` call-sites that rely on |
| 2696 | // the lack of a `return` here to directly call `process::send` so that this |
| 2697 | // function doesn't need to deal with the special case. Then we can check |
| 2698 | // that one of `http` or `pid` is set if the framework is connected. |
| 2699 | } |
| 2700 | |
| 2701 | if (http_.isSome()) { |
| 2702 | if (!http_->send(message)) { |
| 2703 | LOG(WARNING) << "Unable to send message to framework " << *this << ":" |
| 2704 | << " connection closed"; |
| 2705 | } |
| 2706 | } else if (pid().isSome()) { |
| 2707 | master->send(pid().get(), message); |
| 2708 | } else { |
| 2709 | LOG(WARNING) << "Unable to send message to framework " << *this << ":" |
| 2710 | << " framework is recovered but has not reregistered"; |
| 2711 | } |
| 2712 | } |
| 2713 | |
| 2714 | |
| 2715 | // TODO(bevers): Check if there is anything preventing us from |
nothing calls this directly
no test coverage detected