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

Method start_up

runners/proxy/ProxyRunningRequest.cpp:18–46  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16namespace cocoon {
17
18void ProxyRunningRequest::start_up() {
19 LOG(INFO) << "starting proxy request " << id_.to_hex() << ", worker connection id " << worker_->connection_id
20 << " client_request_id=" << client_request_id_.to_hex();
21
22 alarm_timestamp() = td::Timestamp::in(timeout_);
23
24 stats()->requests_received++;
25
26 auto R = cocoon::fetch_tl_object<cocoon_api::http_request>(data_.as_slice(), true);
27 if (R.is_error()) {
28 fail(R.move_as_error_prefix("proxy: received incorrect request: "));
29 return;
30 }
31 auto req = R.move_as_ok();
32 stats()->request_bytes_received += (double)req->payload_.size();
33
34 td::BufferSlice fwd_query;
35 if (worker_proto_version_ > 0) {
36 fwd_query = cocoon::create_serialize_tl_object<cocoon_api::proxy_runQueryEx>(
37 std::move(data_), worker_->info->signed_payment(), coefficient_, timeout_ * 0.95, id_,
38 1 | (worker_proto_version_ >= 3 ? 2 : 0), enable_debug_, encrypted_with_);
39 } else {
40 fwd_query = cocoon::create_serialize_tl_object<cocoon_api::proxy_runQuery>(
41 std::move(data_), worker_->info->signed_payment(), coefficient_, timeout_ * 0.95, id_);
42 }
43
44 td::actor::send_closure(runner_, &ProxyRunner::send_message_to_connection, worker_->connection_id,
45 std::move(fwd_query));
46}
47
48void ProxyRunningRequest::receive_answer_ex_impl(cocoon_api::proxy_queryAnswerEx &ans) {
49 if (sent_answer_) {

Callers

nothing calls this directly

Calls 2

as_sliceMethod · 0.80
signed_paymentMethod · 0.45

Tested by

no test coverage detected