| 1412 | } |
| 1413 | |
| 1414 | void declineOffer( |
| 1415 | const OfferID& offerId, |
| 1416 | const Filters& filters) |
| 1417 | { |
| 1418 | if (!connected) { |
| 1419 | VLOG(1) << "Ignoring decline offer message as master is disconnected"; |
| 1420 | return; |
| 1421 | } |
| 1422 | |
| 1423 | if (!savedOffers.contains(offerId)) { |
| 1424 | LOG(WARNING) << "Attempting to decline an unknown offer " << offerId; |
| 1425 | } |
| 1426 | |
| 1427 | // Remove the offer. We do not need to save any PIDs |
| 1428 | // when declining an offer. |
| 1429 | savedOffers.erase(offerId); |
| 1430 | |
| 1431 | Call call; |
| 1432 | |
| 1433 | CHECK(framework.has_id()); |
| 1434 | call.mutable_framework_id()->CopyFrom(framework.id()); |
| 1435 | call.set_type(Call::DECLINE); |
| 1436 | |
| 1437 | Call::Decline* decline = call.mutable_decline(); |
| 1438 | decline->add_offer_ids()->CopyFrom(offerId); |
| 1439 | decline->mutable_filters()->CopyFrom(filters); |
| 1440 | |
| 1441 | CHECK_SOME(master); |
| 1442 | send(master->pid(), call); |
| 1443 | } |
| 1444 | |
| 1445 | void reviveOffers(const vector<string>& roles) |
| 1446 | { |