MCPcopy Create free account
hub / github.com/apache/mesos / _authenticate

Method _authenticate

src/sched/sched.cpp:462–530  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

460 }
461
462 void _authenticate(Duration currentMinTimeout, Duration currentMaxTimeout)
463 {
464 if (!running.load()) {
465 VLOG(1) << "Ignoring _authenticate because the driver is not running!";
466 return;
467 }
468
469 delete CHECK_NOTNULL(authenticatee);
470 authenticatee = nullptr;
471
472 CHECK_SOME(authenticating);
473 const Future<bool>& future = authenticating.get();
474
475 if (master.isNone()) {
476 LOG(INFO) << "Ignoring _authenticate because the master is lost";
477 authenticating = None();
478 // Set it to false because we do not want further retries until
479 // a new master is detected.
480 // We obviously do not need to reauthenticate either even if
481 // 'reauthenticate' is currently true because the master is
482 // lost.
483 reauthenticate = false;
484 return;
485 }
486
487 if (reauthenticate || !future.isReady()) {
488 LOG(INFO)
489 << "Failed to authenticate with master " << master->pid() << ": "
490 << (reauthenticate ? "master changed" :
491 (future.isFailed() ? future.failure() : "future discarded"));
492
493 authenticating = None();
494 reauthenticate = false;
495
496 // TODO(vinod): Add a limit on number of retries.
497
498 // Grow the timeout range using exponential backoff:
499 //
500 // [min, min + factor * 2^0]
501 // [min, min + factor * 2^1]
502 // ...
503 // [min, min + factor * 2^N]
504 // ...
505 // [min, max] // Stop at max.
506 Duration maxTimeout =
507 currentMinTimeout + (currentMaxTimeout - currentMinTimeout) * 2;
508
509 authenticate(
510 currentMinTimeout,
511 std::min(maxTimeout, flags.authentication_timeout_max));
512
513 return;
514 }
515
516 if (!future.get()) {
517 LOG(ERROR) << "Master " << master->pid() << " refused authentication";
518 error("Master refused authentication");
519 return;

Callers

nothing calls this directly

Calls 10

NoneClass · 0.85
minFunction · 0.85
errorFunction · 0.85
isReadyMethod · 0.80
isFailedMethod · 0.80
failureMethod · 0.80
loadMethod · 0.45
getMethod · 0.45
isNoneMethod · 0.45
pidMethod · 0.45

Tested by

no test coverage detected