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

Method send

src/executor/executor.cpp:351–406  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

349 }
350
351 void send(const Call& call)
352 {
353 Option<Error> error =
354 common::validation::validateExecutorCall(devolve(call));
355 if (error.isSome()) {
356 drop(call, error->message);
357 return;
358 }
359
360 if (call.type() == Call::SUBSCRIBE && state != CONNECTED) {
361 // It might be possible that the executor is retrying. We drop the
362 // request if we have an ongoing subscribe request in flight or if the
363 // executor is already subscribed.
364 drop(call, "Executor is in state " + stringify(state));
365 return;
366 }
367
368 if (call.type() != Call::SUBSCRIBE && state != SUBSCRIBED) {
369 // We drop all non-subscribe calls if we are not currently subscribed.
370 drop(call, "Executor is in state " + stringify(state));
371 return;
372 }
373
374 VLOG(1) << "Sending " << call.type() << " call to " << agent;
375
376 ::Request request;
377 request.method = "POST";
378 request.url = agent;
379 request.body = serialize(contentType, call);
380 request.keepAlive = true;
381 request.headers = {{"Accept", stringify(contentType)},
382 {"Content-Type", stringify(contentType)}};
383
384 if (authenticationToken.isSome()) {
385 request.headers["Authorization"] = "Bearer " + authenticationToken.get();
386 }
387
388 CHECK_SOME(connections);
389
390 Future<Response> response;
391 if (call.type() == Call::SUBSCRIBE) {
392 state = SUBSCRIBING;
393
394 // Send a streaming request for Subscribe call.
395 response = connections->subscribe.send(request, true);
396 } else {
397 response = connections->nonSubscribe.send(request);
398 }
399
400 CHECK_SOME(connectionId);
401 response.onAny(defer(self(),
402 &Self::_send,
403 connectionId.get(),
404 call,
405 lambda::_1));
406 }
407
408 ~MesosProcess() override

Callers

nothing calls this directly

Calls 9

validateExecutorCallFunction · 0.85
deferFunction · 0.85
typeMethod · 0.80
sendMethod · 0.65
devolveFunction · 0.50
stringifyFunction · 0.50
serializeFunction · 0.50
isSomeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected