GramJs: Use "-1" DCs for file transfers (#1332)

This commit is contained in:
Alexander Zinchuk 2021-08-05 13:29:19 +03:00
parent 3455f73ef3
commit dbc5949957
2 changed files with 7 additions and 7 deletions

View File

@ -605,37 +605,37 @@ function isListLike(item) {
)
}
*/
function getDC(dcId) {
function getDC(dcId, download = false) {
// TODO Move to external config
switch (dcId) {
case 1:
return {
id: 1,
ipAddress: 'zws1.web.telegram.org',
ipAddress: `zws1${download ? '-1' : ''}.web.telegram.org`,
port: 443,
};
case 2:
return {
id: 2,
ipAddress: 'zws2.web.telegram.org',
ipAddress: `zws2${download ? '-1' : ''}.web.telegram.org`,
port: 443,
};
case 3:
return {
id: 3,
ipAddress: 'zws3.web.telegram.org',
ipAddress: `zws3${download ? '-1' : ''}.web.telegram.org`,
port: 443,
};
case 4:
return {
id: 4,
ipAddress: 'zws4.web.telegram.org',
ipAddress: `zws4${download ? '-1' : ''}.web.telegram.org`,
port: 443,
};
case 5:
return {
id: 5,
ipAddress: 'zws5.web.telegram.org',
ipAddress: `zws5${download ? '-1' : ''}.web.telegram.org`,
port: 443,
};
default:

View File

@ -325,7 +325,7 @@ class TelegramClient {
}
async _connectSender(sender, dcId) {
const dc = utils.getDC(dcId);
const dc = utils.getDC(dcId, true);
while (true) {
try {