mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-08-31 13:04:02 +03:00
Use contexts for Conn wrapper
This commit is contained in:
+4
-2
@@ -1,6 +1,7 @@
|
||||
package telegram
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
|
||||
"github.com/juju/errors"
|
||||
@@ -32,7 +33,8 @@ type directTelegram struct {
|
||||
baseTelegram
|
||||
}
|
||||
|
||||
func (t *directTelegram) Dial(connID string, connOpts *mtproto.ConnectionOpts) (wrappers.StreamReadWriteCloser, error) {
|
||||
func (t *directTelegram) Dial(ctx context.Context, cancel context.CancelFunc,
|
||||
connID string, connOpts *mtproto.ConnectionOpts) (wrappers.StreamReadWriteCloser, error) {
|
||||
dc := connOpts.DC
|
||||
if dc < 0 {
|
||||
dc = -dc
|
||||
@@ -40,7 +42,7 @@ func (t *directTelegram) Dial(connID string, connOpts *mtproto.ConnectionOpts) (
|
||||
dc = 1
|
||||
}
|
||||
|
||||
return t.baseTelegram.dial(dc-1, connID, connOpts.ConnectionProto)
|
||||
return t.baseTelegram.dial(ctx, cancel, dc-1, connID, connOpts.ConnectionProto)
|
||||
}
|
||||
|
||||
func (t *directTelegram) Init(connOpts *mtproto.ConnectionOpts,
|
||||
|
||||
Reference in New Issue
Block a user