rpki-client don't clobber poll events

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

rpki-client don't clobber poll events

Claudio Jeker
It is perfectly fine to wait for read and write at the same time.
The code in rpki-client should do that too, I think it will not matter
but it is what I intended.

--
:wq Claudio

Index: main.c
===================================================================
RCS file: /cvs/src/usr.sbin/rpki-client/main.c,v
retrieving revision 1.105
diff -u -p -r1.105 main.c
--- main.c 23 Feb 2021 14:25:29 -0000 1.105
+++ main.c 23 Feb 2021 16:00:23 -0000
@@ -984,10 +984,10 @@ main(int argc, char *argv[])
  while (entity_queue > 0 && !killme) {
  pfd[0].events = POLLIN;
  if (rsyncq.queued)
- pfd[0].events = POLLOUT;
+ pfd[0].events |= POLLOUT;
  pfd[1].events = POLLIN;
  if (procq.queued)
- pfd[1].events = POLLOUT;
+ pfd[1].events |= POLLOUT;
 
  if ((c = poll(pfd, 2, INFTIM)) == -1) {
  if (errno == EINTR)

Reply | Threaded
Open this post in threaded view
|

Re: rpki-client don't clobber poll events

Theo de Raadt-2
Definately!  It will round-trip through poll() less often.

Claudio Jeker <[hidden email]> wrote:

> It is perfectly fine to wait for read and write at the same time.
> The code in rpki-client should do that too, I think it will not matter
> but it is what I intended.
>
> --
> :wq Claudio
>
> Index: main.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/rpki-client/main.c,v
> retrieving revision 1.105
> diff -u -p -r1.105 main.c
> --- main.c 23 Feb 2021 14:25:29 -0000 1.105
> +++ main.c 23 Feb 2021 16:00:23 -0000
> @@ -984,10 +984,10 @@ main(int argc, char *argv[])
>   while (entity_queue > 0 && !killme) {
>   pfd[0].events = POLLIN;
>   if (rsyncq.queued)
> - pfd[0].events = POLLOUT;
> + pfd[0].events |= POLLOUT;
>   pfd[1].events = POLLIN;
>   if (procq.queued)
> - pfd[1].events = POLLOUT;
> + pfd[1].events |= POLLOUT;
>  
>   if ((c = poll(pfd, 2, INFTIM)) == -1) {
>   if (errno == EINTR)
>