1
0
Fork 0
mirror of https://github.com/diamondburned/arikawa.git synced 2025-02-11 05:52:58 +00:00

Gateway: Removed redundant context

This commit is contained in:
diamondburned 2020-02-11 09:29:30 -08:00
parent ff6669a58d
commit 76c7760c24
2 changed files with 4 additions and 9 deletions

View file

@ -134,11 +134,8 @@ func NewGatewayWithDriver(token string, driver json.Driver) (*Gateway, error) {
// Append the form to the URL // Append the form to the URL
URL += "?" + param.Encode() URL += "?" + param.Encode()
ctx, cancel := context.WithTimeout(context.Background(), g.WSTimeout)
defer cancel()
// Create a new undialed Websocket. // Create a new undialed Websocket.
ws, err := wsutil.NewCustom(ctx, wsutil.NewConn(driver), URL) ws, err := wsutil.NewCustom(wsutil.NewConn(driver), URL)
if err != nil { if err != nil {
return nil, errors.Wrap(err, "Failed to connect to Gateway "+URL) return nil, errors.Wrap(err, "Failed to connect to Gateway "+URL)
} }

View file

@ -31,14 +31,12 @@ type Websocket struct {
dialed bool dialed bool
} }
func New(ctx context.Context, addr string) (*Websocket, error) { func New(addr string) (*Websocket, error) {
return NewCustom(ctx, NewConn(json.Default{}), addr) return NewCustom(NewConn(json.Default{}), addr)
} }
// NewCustom creates a new undialed Websocket. // NewCustom creates a new undialed Websocket.
func NewCustom( func NewCustom(conn Connection, addr string) (*Websocket, error) {
ctx context.Context, conn Connection, addr string) (*Websocket, error) {
ws := &Websocket{ ws := &Websocket{
Conn: conn, Conn: conn,
Addr: addr, Addr: addr,