Mesos Principles and Code Analysis (3): Mesos Master Start-up II

Source: Internet
Author: User

2. Process::firewall::install (move rules); if there is a parameter--firewall_rules the rule is added

?

The corresponding code is as follows:

Initialize firewall rules.

if (Flags.firewall_rules.isSome ()) {

Vector<owned<firewallrule>> rules;

?

Const Firewall Firewall = Flags.firewall_rules.get ();

?

if (firewall.has_disabled_endpoints ()) {

hashset<string> paths;

?

foreach (const string& path, firewall.disabled_endpoints (). paths ()) {

Paths.insert (path);

}

?

Rules.emplace_back (new Disabledendpointsfirewallrule (paths));

}

?

Process::firewall::install (Move (rules));

}

?

The corresponding command line parameters are as follows:

?

The main function of this parameter is, not mesos every API to want to expose, disabled_endpoints inside is unreachable API.

?

The above install code will do the following things

?

?

It will eventually be put into the environment variable firewallrules.

?

So what do these firewall work for?

?

There's a function in 3rdparty/libprocess/src/process.cpp.

?

Synchronized (Firewall_mutex) {

Don ' t use a const reference, since it cannot be guaranteed

That the rules don ' t keep a internal state.

foreach (owned<firewall::firewallrule>& rule, firewallrules) {

option<response> rejection = rule->apply (socket, *request);

if (Rejection.issome ()) {

VLOG (1) << "returning" "<< rejection.get (). Status << ' for '

<< request->url.path << "' (Firewall rule forbids request)";

?

TODO (arojas): Get rid of the duplicated code to return an

Error.

?

Get the Httpproxy PID for this socket.

Pid

?

Enqueue the response with the httpproxy so it respects

The order of requests to account for http/1.1 pipelining.

Dispatch

Proxy

&httpproxy::enqueue,

Rejection.get (),

*request);

?

Cleanup request.

Delete request;

Return

}

}

}

?

Mesos Principles and Code Analysis (3): Mesos Master Start-up II

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.