| 162 | } |
| 163 | |
| 164 | void shutdown() |
| 165 | { |
| 166 | // Logically an executor cannot receive any response from an agent if it |
| 167 | // is not connected. Since we have received `shutdown`, we assume we are |
| 168 | // connected and trigger the `connected` callback to enable event delivery. |
| 169 | // This satisfies the invariant of the v1 interface that an executor can |
| 170 | // receive an event only after successfully connecting with the agent. |
| 171 | if (!connected) { |
| 172 | LOG(INFO) << "Implicitly connecting the executor to shut it down"; |
| 173 | callbacks.connected(); |
| 174 | connected = true; |
| 175 | } |
| 176 | |
| 177 | Event event; |
| 178 | event.set_type(Event::SHUTDOWN); |
| 179 | |
| 180 | received(event); |
| 181 | } |
| 182 | |
| 183 | void error(const string& message) |
| 184 | { |