Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-reuseport
Commits
f08ef691
Commit
f08ef691
authored
Jan 19, 2015
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move fix to dialer.Dial
parent
95e03a33
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
interface.go
interface.go
+14
-14
No files found.
interface.go
View file @
f08ef691
...
...
@@ -58,10 +58,23 @@ func Dial(network, laddr, raddr string) (net.Conn, error) {
d
.
D
.
LocalAddr
=
netladdr
}
return
d
.
Dial
(
network
,
raddr
)
}
// Dialer is used to specify the Dial options, much like net.Dialer.
// We simply wrap a net.Dialer.
type
Dialer
struct
{
D
net
.
Dialer
}
// Dial dials the given network and address. see net.Dialer.Dial
// Returns a net.Conn created from a file discriptor for a socket
// with SO_REUSEPORT and SO_REUSEADDR option set.
func
(
d
*
Dialer
)
Dial
(
network
,
address
string
)
(
net
.
Conn
,
error
)
{
// there's a rare case where dial returns successfully but for some reason the
// RemoteAddr is not yet set. We wait here a while until it is, and if too long
// passes, we fail.
c
,
err
:=
dial
(
d
.
D
,
network
,
r
addr
)
c
,
err
:=
dial
(
d
.
D
,
network
,
addr
ess
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -76,16 +89,3 @@ func Dial(network, laddr, raddr string) (net.Conn, error) {
}
return
c
,
nil
}
// Dialer is used to specify the Dial options, much like net.Dialer.
// We simply wrap a net.Dialer.
type
Dialer
struct
{
D
net
.
Dialer
}
// Dial dials the given network and address. see net.Dialer.Dial
// Returns a net.Conn created from a file discriptor for a socket
// with SO_REUSEPORT and SO_REUSEADDR option set.
func
(
d
*
Dialer
)
Dial
(
network
,
address
string
)
(
net
.
Conn
,
error
)
{
return
dial
(
d
.
D
,
network
,
address
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment