Skip to content

Commit

Permalink
forgot to close channels after use.
Browse files Browse the repository at this point in the history
  • Loading branch information
AmarnathCJD committed Nov 20, 2024
1 parent 76090f2 commit 656b513
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 28 deletions.
4 changes: 3 additions & 1 deletion internal/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -32,6 +32,8 @@ var DcList = DCOptions{
},
}

// TODO: Fix DC4 Ipv6 is Unreachable

type DC struct {
Addr string
V bool
Expand Down
27 changes: 0 additions & 27 deletions telegram/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions telegram/media.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 656b513

Please sign in to comment.