ソースを参照

Do not panic if no addresses were found

tags/v2.1.12^2^2
9seconds 2ヶ月前
コミット
449f84133a
2個のファイルの変更4行の追加1行の削除
  1. 1
    1
      mtglib/internal/dc/updater.go
  2. 3
    0
      mtglib/proxy.go

+ 1
- 1
mtglib/internal/dc/updater.go ファイルの表示

@@ -32,7 +32,7 @@ func (u *updater) run(ctx context.Context, callback func() error) {
32 32
 		for {
33 33
 			u.logger.Info("start update")
34 34
 			if err := callback(); err != nil {
35
-				u.logger.WarningError("cannot update: %w", err)
35
+				u.logger.WarningError("cannot update", err)
36 36
 			}
37 37
 			u.logger.Info("updated")
38 38
 

+ 3
- 0
mtglib/proxy.go ファイルの表示

@@ -252,6 +252,9 @@ func (p *Proxy) doTelegramCall(ctx *streamContext) error {
252 252
 	if err != nil {
253 253
 		return fmt.Errorf("no addresses to call: %w", err)
254 254
 	}
255
+	if conn == nil {
256
+		return fmt.Errorf("no available addresses for DC %d", ctx.dc)
257
+	}
255 258
 
256 259
 	tgConn, err := foundAddr.Obfuscator.SendHandshake(conn, ctx.dc)
257 260
 	if err != nil {

読み込み中…
キャンセル
保存