MCPcopy Create free account
hub / github.com/TelegramMessenger/cocoon / send_handshake

Method send_handshake

runners/client/ClientProxyConnection.cpp:20–55  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18}
19
20void ClientProxyConnection::send_handshake() {
21 LOG(INFO) << "created connection " << connection_id() << ", sending handshake";
22 if (runner()->check_image_hashes()) {
23 if (!runner()->runner_config()->root_contract_config->has_proxy_hash(remote_app_hash())) {
24 fail_connection(td::Status::Error("invalid proxy hash"));
25 return;
26 }
27 }
28 {
29 auto S = runner()->check_verification_key(remote_app_type(), verified_by());
30 if (S.is_error()) {
31 return fail_connection(std::move(S));
32 }
33 }
34 auto params = ton::create_tl_object<cocoon_api::client_params>(3, runner()->cocoon_wallet_address().rserialize(true),
35 runner()->is_test(), runner()->min_proto_version(),
36 runner()->max_proto_version());
37 auto req = cocoon::create_serialize_tl_object<cocoon_api::client_connectToProxy>(
38 std::move(params), runner()->runner_config()->root_contract_config->version());
39 runner()->send_handshake_query_to_connection(
40 connection_id(), "connect", std::move(req), td::Timestamp::in(30.0),
41 [runner_actor_id = actor_id(runner()), runner = runner(),
42 connection_id = connection_id()](td::Result<td::BufferSlice> R) {
43 td::actor::send_lambda(runner_actor_id, [runner, connection_id, R = std::move(R)]() mutable {
44 auto self = (ClientProxyConnection *)runner->get_connection(connection_id);
45 if (!self) {
46 return;
47 }
48 if (R.is_ok()) {
49 self->received_handshake_answer(R.move_as_ok());
50 } else {
51 self->fail_connection(R.move_as_error());
52 }
53 });
54 });
55}
56
57void ClientProxyConnection::received_handshake_answer(td::BufferSlice answer) {
58 std::shared_ptr<ClientProxyInfo> proxy;

Callers

nothing calls this directly

Calls 11

check_image_hashesMethod · 0.80
has_proxy_hashMethod · 0.80
versionMethod · 0.80
get_connectionMethod · 0.80
is_testMethod · 0.45
min_proto_versionMethod · 0.45
max_proto_versionMethod · 0.45
fail_connectionMethod · 0.45

Tested by

no test coverage detected