From 656b513284debbd6f51ca94fce00f492fef2809c Mon Sep 17 00:00:00 2001 From: AmarnathCJD Date: Wed, 20 Nov 2024 12:33:37 +0530 Subject: [PATCH] forgot to close channels after use. --- internal/utils/utils.go | 4 +++- telegram/helpers.go | 27 --------------------------- telegram/media.go | 3 +++ 3 files changed, 6 insertions(+), 28 deletions(-) diff --git a/internal/utils/utils.go b/internal/utils/utils.go index b07d257c..01ad964b 100755 --- a/internal/utils/utils.go +++ b/internal/utils/utils.go @@ -22,7 +22,7 @@ var DcList = DCOptions{ 2: {{"149.154.167.50:443", false}}, 3: {{"149.154.175.100:443", false}}, 4: {{"149.154.167.91:443", false}, - {"[2001:067c:04e8:f002::a]:443", true}}, + {"[2001:067c:04e8:f002::a]:443", true}}, // THIS IS DC2 IPv6 5: {{"91.108.56.151:443", false}}, }, TestDCs: map[int]string{ @@ -32,6 +32,8 @@ var DcList = DCOptions{ }, } +// TODO: Fix DC4 Ipv6 is Unreachable + type DC struct { Addr string V bool diff --git a/telegram/helpers.go b/telegram/helpers.go index dcfeb6f5..926030d0 100644 --- a/telegram/helpers.go +++ b/telegram/helpers.go @@ -20,38 +20,11 @@ import ( "github.com/pkg/errors" ) -var DataCenters = map[int]string{ - 1: "149.154.175.58:443", - 2: "149.154.167.50:443", - 3: "149.154.175.100:443", - 4: "149.154.167.91:443", - 5: "91.108.56.151:443", -} - -var TestDataCenters = map[int]string{ - 1: "149.154.175.10:443", - 2: "149.154.167.40:443", - 3: "149.154.175.117:443", -} - func FileExists(path string) bool { _, err := os.Stat(path) return err == nil } -func GetHostIp(dcID int, test bool) string { - if test { - if ip, ok := TestDataCenters[dcID]; ok { - return ip - } - } - - if ip, ok := DataCenters[dcID]; ok { - return ip - } - panic("invalid dc-id provided") -} - func joinAbsWorkingDir(filename string) string { if filename == "" { filename = "session.dat" // default filename for session file diff --git a/telegram/media.go b/telegram/media.go index 2c0ff4a6..d8f47837 100644 --- a/telegram/media.go +++ b/telegram/media.go @@ -294,6 +294,9 @@ func (c *Client) UploadFile(src interface{}, Opts ...*UploadOptions) (InputFile, } } + close(sem) + close(progressTicker) + if opts.ProgressManager != nil { opts.ProgressManager.editFunc(size, size) }