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