MCPcopy Create free account
hub / github.com/3rdparty/libprocess / foreach

Function foreach

src/tests/ssl_tests.cpp:545–582  ·  view source on GitHub ↗

For each protocol.

Source from the content-addressed store, hash-verified

543{
544 // For each protocol.
545 foreach (const string& server_protocol, protocols) {
546 LOG(INFO) << "Testing server protocol '" << server_protocol << "'\n";
547
548 // Set up the default server environment variables.
549 map<string, string> server_environment = {
550 {"LIBPROCESS_SSL_ENABLED", "true"},
551 {"LIBPROCESS_SSL_SUPPORT_DOWNGRADE", "true"},
552 {"LIBPROCESS_SSL_KEY_FILE", key_path().string()},
553 {"LIBPROCESS_SSL_CERT_FILE", certificate_path().string()}
554 };
555
556 // Disable all protocols except for the one we're testing.
557 foreach (const string& protocol, protocols) {
558 server_environment.emplace(
559 protocol,
560 stringify(protocol == server_protocol));
561 }
562
563 // Set up the server.
564 Try<Socket> server = setup_server(server_environment);
565 ASSERT_SOME(server);
566
567 // Launch the client with a POLL socket.
568 Try<Subprocess> client = launch_client({
569 {"LIBPROCESS_SSL_ENABLED", "false"}},
570 server.get(),
571 false);
572 ASSERT_SOME(client);
573
574 Future<Socket> socket = server->accept();
575 AWAIT_ASSERT_READY(socket);
576
577 // TODO(jmlvanre): Remove const copy.
578 AWAIT_ASSERT_EQ(data, Socket(socket.get()).recv());
579 AWAIT_ASSERT_READY(Socket(socket.get()).send(data));
580
581 AWAIT_ASSERT_READY(await_subprocess(client.get(), 0));
582 }
583}
584
585

Callers

nothing calls this directly

Calls 7

SocketClass · 0.85
await_subprocessFunction · 0.85
stringMethod · 0.80
getMethod · 0.45
acceptMethod · 0.45
recvMethod · 0.45
sendMethod · 0.45

Tested by

no test coverage detected