session: Remove unused function initConnect

This commit is contained in:
diamondburned 2022-08-22 01:08:24 -07:00
parent a1334c45f4
commit d62c1169b5
No known key found for this signature in database
GPG Key ID: D78C4471CE776659
1 changed files with 0 additions and 36 deletions

View File

@ -213,42 +213,6 @@ func (s *Session) Connect(ctx context.Context) error {
return nil
}
func (s *Session) initConnect(ctx context.Context) (<-chan struct{}, error) {
evCh := make(chan interface{})
s.state.Lock()
defer s.state.Unlock()
if s.state.cancel != nil {
if err := s.close(); err != nil {
return nil, err
}
}
if s.state.gateway == nil {
g, err := gateway.NewWithIdentifier(ctx, s.state.id)
if err != nil {
return nil, err
}
s.state.gateway = g
}
ctx, cancel := context.WithCancel(context.Background())
s.state.ctx = ctx
s.state.cancel = cancel
// TODO: change this to AddSyncHandler.
rm := s.AddHandler(evCh)
defer rm()
opCh := s.state.gateway.Connect(s.state.ctx)
doneCh := ophandler.Loop(opCh, s.Handler)
s.state.doneCh = doneCh
return doneCh, nil
}
// Open opens the Discord gateway and its handler, then waits until either the
// Ready or Resumed event gets through. Prefer using Connect instead of Open.
func (s *Session) Open(ctx context.Context) error {