Projects STRLCPY prox5 Commits 61b1bd53
🤬
  • ■ ■ ■ ■ ■
    mystery_dialer.go
    skipped 24 lines
    25 25  // DialTimeout is a simple stub adapter to implement a net.Dialer with a timeout.
    26 26  func (s *Swamp) DialTimeout(network, addr string, timeout time.Duration) (net.Conn, error) {
    27 27   ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(timeout))
    28  - defer cancel()
     28 + go func() {
     29 + select {
     30 + case <-ctx.Done():
     31 + cancel()
     32 + }
     33 + }()
    29 34   return s.MysteryDialer(ctx, network, addr)
    30 35  }
    31 36   
    skipped 41 lines
Please wait...
Page is in error, reload to recover