Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
labs
BIRD Internet Routing Daemon
Commits
fd926ed4
Commit
fd926ed4
authored
Mar 15, 2016
by
Jan Moskyto Matejka
Browse files
Poll: Prevent the improbable case of EAGAIN after POLLIN
parent
e1c13a5a
Changes
2
Hide whitespace changes
Inline
Side-by-side
proto/bfd/io.c
View file @
fd926ed4
...
...
@@ -576,7 +576,7 @@ sockets_close_fds(struct birdloop *loop)
loop
->
close_scheduled
=
0
;
}
int
sk_read
(
sock
*
s
);
int
sk_read
(
sock
*
s
,
int
revents
);
int
sk_write
(
sock
*
s
);
static
void
...
...
@@ -605,7 +605,7 @@ sockets_fire(struct birdloop *loop)
if
(
pfd
->
revents
&
POLLIN
)
while
(
e
&&
*
psk
&&
(
*
psk
)
->
rx_hook
)
e
=
sk_read
(
*
psk
);
e
=
sk_read
(
*
psk
,
0
);
e
=
1
;
if
(
pfd
->
revents
&
POLLOUT
)
...
...
sysdep/unix/io.c
View file @
fd926ed4
...
...
@@ -1760,7 +1760,7 @@ sk_send_full(sock *s, unsigned len, struct iface *ifa,
/* sk_read() and sk_write() are called from BFD's event loop */
int
sk_read
(
sock
*
s
)
sk_read
(
sock
*
s
,
int
revents
)
{
switch
(
s
->
type
)
{
...
...
@@ -1779,6 +1779,11 @@ sk_read(sock *s)
{
if
(
errno
!=
EINTR
&&
errno
!=
EAGAIN
)
s
->
err_hook
(
s
,
errno
);
else
if
(
errno
==
EAGAIN
&&
!
(
revents
&
POLLIN
))
{
log
(
L_ERR
"Got EAGAIN from read when revents=%x (without POLLIN)"
,
revents
);
s
->
err_hook
(
s
,
0
);
}
}
else
if
(
!
c
)
s
->
err_hook
(
s
,
0
);
...
...
@@ -2159,7 +2164,7 @@ io_loop(void)
{
steps
--
;
io_log_event
(
s
->
rx_hook
,
s
->
data
);
e
=
sk_read
(
s
);
e
=
sk_read
(
s
,
pfd
[
s
->
index
].
revents
);
if
(
s
!=
current_sock
)
goto
next
;
}
...
...
@@ -2203,7 +2208,7 @@ io_loop(void)
{
count
++
;
io_log_event
(
s
->
rx_hook
,
s
->
data
);
sk_read
(
s
);
sk_read
(
s
,
pfd
[
s
->
index
].
revents
);
if
(
s
!=
current_sock
)
goto
next2
;
}
...
...
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