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

Method http_charge

runners/proxy/ProxyRunner.cpp:1619–1636  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1617}
1618
1619std::string ProxyRunner::http_charge(std::string client_owner_address_str) {
1620 auto it2 = clients_.find(client_owner_address_str);
1621 if (it2 == clients_.end()) {
1622 return wrap_short_answer_to_http("client not found");
1623 }
1624
1625 auto &client = *it2->second;
1626
1627 if (client.charging_now()) {
1628 return wrap_short_answer_to_http("request already running");
1629 }
1630 if (!client.tokens_ready_to_charge()) {
1631 return wrap_short_answer_to_http("nothing to charge");
1632 }
1633
1634 client_charge(client, false);
1635 return wrap_short_answer_to_http("request sent");
1636}
1637
1638std::string ProxyRunner::http_enable_disable(td::int64 disable_up_to_version) {
1639 proxy_enable_disable(disable_up_to_version);

Callers

nothing calls this directly

Calls 2

charging_nowMethod · 0.80

Tested by

no test coverage detected