Add DcId::MAX_RAW_DC_ID.
This commit is contained in:
parent
d5f7423b52
commit
f2114f34f5
@ -17,8 +17,10 @@ class DcId {
|
||||
public:
|
||||
DcId() = default;
|
||||
|
||||
static constexpr int32 MAX_RAW_DC_ID = 1000;
|
||||
|
||||
static bool is_valid(int32 dc_id) {
|
||||
return 1 <= dc_id && dc_id <= 1000;
|
||||
return 1 <= dc_id && dc_id <= MAX_RAW_DC_ID;
|
||||
}
|
||||
static DcId main() {
|
||||
return DcId{MainDc, false};
|
||||
|
@ -224,8 +224,8 @@ void NetQueryDispatcher::update_session_count() {
|
||||
std::lock_guard<std::mutex> guard(main_dc_id_mutex_);
|
||||
int32 session_count = get_session_count();
|
||||
bool use_pfs = get_use_pfs();
|
||||
for (size_t i = 1; i < MAX_DC_COUNT; i++) {
|
||||
if (is_dc_inited(narrow_cast<int32>(i))) {
|
||||
for (int32 i = 1; i < DcId::MAX_RAW_DC_ID; i++) {
|
||||
if (is_dc_inited(i)) {
|
||||
send_closure_later(dcs_[i - 1].main_session_, &SessionMultiProxy::update_options, session_count, use_pfs,
|
||||
need_destroy_auth_key_);
|
||||
send_closure_later(dcs_[i - 1].upload_session_, &SessionMultiProxy::update_use_pfs, use_pfs);
|
||||
@ -238,8 +238,8 @@ void NetQueryDispatcher::destroy_auth_keys(Promise<> promise) {
|
||||
std::lock_guard<std::mutex> guard(main_dc_id_mutex_);
|
||||
LOG(INFO) << "Destroy auth keys";
|
||||
need_destroy_auth_key_ = true;
|
||||
for (size_t i = 1; i < MAX_DC_COUNT; i++) {
|
||||
if (is_dc_inited(narrow_cast<int32>(i)) && dcs_[i - 1].id_.is_internal()) {
|
||||
for (int32 i = 1; i < DcId::MAX_RAW_DC_ID; i++) {
|
||||
if (is_dc_inited(i) && dcs_[i - 1].id_.is_internal()) {
|
||||
send_closure_later(dcs_[i - 1].main_session_, &SessionMultiProxy::destroy_auth_key);
|
||||
}
|
||||
}
|
||||
@ -249,8 +249,8 @@ void NetQueryDispatcher::destroy_auth_keys(Promise<> promise) {
|
||||
void NetQueryDispatcher::update_use_pfs() {
|
||||
std::lock_guard<std::mutex> guard(main_dc_id_mutex_);
|
||||
bool use_pfs = get_use_pfs();
|
||||
for (size_t i = 1; i < MAX_DC_COUNT; i++) {
|
||||
if (is_dc_inited(narrow_cast<int32>(i))) {
|
||||
for (int32 i = 1; i < DcId::MAX_RAW_DC_ID; i++) {
|
||||
if (is_dc_inited(i)) {
|
||||
send_closure_later(dcs_[i - 1].main_session_, &SessionMultiProxy::update_use_pfs, use_pfs);
|
||||
send_closure_later(dcs_[i - 1].upload_session_, &SessionMultiProxy::update_use_pfs, use_pfs);
|
||||
send_closure_later(dcs_[i - 1].download_session_, &SessionMultiProxy::update_use_pfs, use_pfs);
|
||||
@ -261,8 +261,8 @@ 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))) {
|
||||
for (int32 i = 1; i < DcId::MAX_RAW_DC_ID; i++) {
|
||||
if (is_dc_inited(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);
|
||||
|
@ -74,8 +74,7 @@ class NetQueryDispatcher {
|
||||
ActorOwn<SessionMultiProxy> download_small_session_;
|
||||
ActorOwn<SessionMultiProxy> upload_session_;
|
||||
};
|
||||
static constexpr size_t MAX_DC_COUNT = 1000;
|
||||
std::array<Dc, MAX_DC_COUNT> dcs_;
|
||||
std::array<Dc, DcId::MAX_RAW_DC_ID> dcs_;
|
||||
#if TD_EMSCRIPTEN // FIXME
|
||||
std::atomic<int32> main_dc_id_{2};
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user