mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-02-09 21:16:51 +00:00
Gateway: Removed redundant context
This commit is contained in:
parent
ff6669a58d
commit
76c7760c24
|
@ -134,11 +134,8 @@ func NewGatewayWithDriver(token string, driver json.Driver) (*Gateway, error) {
|
|||
// Append the form to the URL
|
||||
URL += "?" + param.Encode()
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), g.WSTimeout)
|
||||
defer cancel()
|
||||
|
||||
// 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 {
|
||||
return nil, errors.Wrap(err, "Failed to connect to Gateway "+URL)
|
||||
}
|
||||
|
|
|
@ -31,14 +31,12 @@ type Websocket struct {
|
|||
dialed bool
|
||||
}
|
||||
|
||||
func New(ctx context.Context, addr string) (*Websocket, error) {
|
||||
return NewCustom(ctx, NewConn(json.Default{}), addr)
|
||||
func New(addr string) (*Websocket, error) {
|
||||
return NewCustom(NewConn(json.Default{}), addr)
|
||||
}
|
||||
|
||||
// NewCustom creates a new undialed Websocket.
|
||||
func NewCustom(
|
||||
ctx context.Context, conn Connection, addr string) (*Websocket, error) {
|
||||
|
||||
func NewCustom(conn Connection, addr string) (*Websocket, error) {
|
||||
ws := &Websocket{
|
||||
Conn: conn,
|
||||
Addr: addr,
|
||||
|
|
Loading…
Reference in a new issue