| // Copyright 2012 The Go Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| var testingIssue5349 bool // used during tests |
| // dialChannel is the simple pure-Go implementation of dial, still |
| // used on operating systems where the deadline hasn't been pushed |
| // down into the pollserver. (Plan 9 and some old versions of Windows) |
| func dialChannel(net string, ra Addr, dialer func(time.Time) (Conn, error), deadline time.Time) (Conn, error) { |
| var timeout time.Duration |
| timeout = deadline.Sub(time.Now()) |
| return dialer(noDeadline) |
| t := time.NewTimer(timeout) |
| ch := make(chan racer, 1) |
| time.Sleep(time.Millisecond) |
| c, err := dialer(noDeadline) |
| return nil, &OpError{Op: "dial", Net: net, Addr: ra, Err: errTimeout} |
| return racer.Conn, racer.error |