Notify sessions about mtproto header updates.
GitOrigin-RevId: 35ee6055c65c7656726a20672fa600823a13ac5f
This commit is contained in:
parent
47d5082253
commit
1492467ab8
@ -229,8 +229,13 @@ void ConnectionCreator::set_proxy_impl(Proxy proxy, bool from_db) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (proxy_.type() == Proxy::Type::Mtproto || proxy.type() == Proxy::Type::Mtproto) {
|
||||
G()->mtproto_header().set_proxy(proxy);
|
||||
G()->net_query_dispatcher().update_mtproto_header();
|
||||
}
|
||||
|
||||
proxy_ = std::move(proxy);
|
||||
G()->mtproto_header().set_proxy(proxy_);
|
||||
|
||||
send_closure(G()->state_manager(), &StateManager::on_proxy, have_proxy);
|
||||
|
||||
if (!from_db) {
|
||||
|
@ -221,6 +221,19 @@ void NetQueryDispatcher::update_use_pfs() {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NetQueryDispatcher::update_mtproto_header() {
|
||||
std::lock_guard<std::mutex> guard(main_dc_id_mutex_);
|
||||
for (size_t i = 1; i < MAX_DC_COUNT; i++) {
|
||||
if (is_dc_inited(narrow_cast<int32>(i))) {
|
||||
send_closure_later(dcs_[i - 1].main_session_, &SessionMultiProxy::update_mtproto_header);
|
||||
send_closure_later(dcs_[i - 1].upload_session_, &SessionMultiProxy::update_mtproto_header);
|
||||
send_closure_later(dcs_[i - 1].download_session_, &SessionMultiProxy::update_mtproto_header);
|
||||
send_closure_later(dcs_[i - 1].download_small_session_, &SessionMultiProxy::update_mtproto_header);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void NetQueryDispatcher::update_valid_dc(DcId dc_id) {
|
||||
wait_dc_init(dc_id, true);
|
||||
}
|
||||
|
@ -45,8 +45,11 @@ class NetQueryDispatcher {
|
||||
|
||||
void update_session_count();
|
||||
void update_use_pfs();
|
||||
void update_mtproto_header();
|
||||
|
||||
void update_valid_dc(DcId dc_id);
|
||||
DcId main_dc_id() {
|
||||
|
||||
DcId main_dc_id() const {
|
||||
return DcId::internal(main_dc_id_.load());
|
||||
}
|
||||
|
||||
|
@ -87,6 +87,10 @@ void SessionMultiProxy::update_options(int32 session_count, bool use_pfs) {
|
||||
}
|
||||
}
|
||||
|
||||
void SessionMultiProxy::update_mtproto_header() {
|
||||
init();
|
||||
}
|
||||
|
||||
void SessionMultiProxy::start_up() {
|
||||
init();
|
||||
}
|
||||
|
@ -32,6 +32,7 @@ class SessionMultiProxy : public Actor {
|
||||
void update_session_count(int32 session_count);
|
||||
void update_use_pfs(bool use_pfs);
|
||||
void update_options(int32 session_count, bool use_pfs);
|
||||
void update_mtproto_header();
|
||||
|
||||
private:
|
||||
size_t pos_ = 0;
|
||||
|
Reference in New Issue
Block a user