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
b11afac0
Commit
b11afac0
authored
Jan 19, 2015
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
proper waiting
parent
f2ab96a8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
impl_unix.go
impl_unix.go
+7
-1
No files found.
impl_unix.go
View file @
b11afac0
...
...
@@ -314,6 +314,7 @@ func connect(fd int, ra syscall.Sockaddr) error {
}
var
err
error
start
:=
time
.
Now
()
for
{
// if err := fd.pd.WaitWrite(); err != nil {
// return err
...
...
@@ -321,7 +322,8 @@ func connect(fd int, ra syscall.Sockaddr) error {
// i'd use the above fd.pd.WaitWrite to poll io correctly, just like net sockets...
// but of course, it uses fucking runtime_* functions that _cannot_ be used by
// non-go-stdlib source... seriously guys, what kind of bullshit is that!?
<-
time
.
After
(
20
*
time
.
Microsecond
)
// we're relegated to using syscall.Select (what nightmare that is) or using
// a simple but totally bogus time-based wait. garbage.
var
nerr
int
nerr
,
err
=
syscall
.
GetsockoptInt
(
fd
,
syscall
.
SOL_SOCKET
,
syscall
.
SO_ERROR
)
if
err
!=
nil
{
...
...
@@ -329,6 +331,10 @@ func connect(fd int, ra syscall.Sockaddr) error {
}
switch
err
=
syscall
.
Errno
(
nerr
);
err
{
case
syscall
.
EINPROGRESS
,
syscall
.
EALREADY
,
syscall
.
EINTR
:
if
time
.
Now
()
.
Sub
(
start
)
>
time
.
Second
{
return
err
}
<-
time
.
After
(
20
*
time
.
Microsecond
)
case
syscall
.
Errno
(
0
),
syscall
.
EISCONN
:
return
nil
default
:
...
...
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