mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-12 05:34:41 +00:00
pimd: Modify pim_sock_read to read 3 times before yielding
Modify pim_sock_read to read up to 3 packets before yielding the cpu to something else. Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
This commit is contained in:
parent
5441e69048
commit
db48bcb23e
@ -289,16 +289,33 @@ static int pim_sock_read(struct thread *t)
|
|||||||
int len;
|
int len;
|
||||||
ifindex_t ifindex = -1;
|
ifindex_t ifindex = -1;
|
||||||
int result = -1; /* defaults to bad */
|
int result = -1; /* defaults to bad */
|
||||||
|
static long long count = 0;
|
||||||
|
int cont = 1;
|
||||||
|
|
||||||
ifp = THREAD_ARG(t);
|
ifp = THREAD_ARG(t);
|
||||||
fd = THREAD_FD(t);
|
fd = THREAD_FD(t);
|
||||||
|
|
||||||
pim_ifp = ifp->info;
|
pim_ifp = ifp->info;
|
||||||
|
|
||||||
|
while (cont)
|
||||||
|
{
|
||||||
len = pim_socket_recvfromto(fd, buf, sizeof(buf),
|
len = pim_socket_recvfromto(fd, buf, sizeof(buf),
|
||||||
&from, &fromlen,
|
&from, &fromlen,
|
||||||
&to, &tolen,
|
&to, &tolen,
|
||||||
&ifindex);
|
&ifindex);
|
||||||
|
if (len < 0)
|
||||||
|
{
|
||||||
|
if (errno == EINTR)
|
||||||
|
continue;
|
||||||
|
if (errno == EWOULDBLOCK || errno == EAGAIN)
|
||||||
|
{
|
||||||
|
cont = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (PIM_DEBUG_PIM_PACKETS)
|
||||||
|
zlog_debug ("Received errno: %d %s", errno, safe_strerror (errno));
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef PIM_CHECK_RECV_IFINDEX_SANITY
|
#ifdef PIM_CHECK_RECV_IFINDEX_SANITY
|
||||||
/* ifindex sanity check */
|
/* ifindex sanity check */
|
||||||
@ -335,6 +352,11 @@ static int pim_sock_read(struct thread *t)
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
count++;
|
||||||
|
if (count % 3 == 0)
|
||||||
|
cont = 0;
|
||||||
|
}
|
||||||
|
|
||||||
result = 0; /* good */
|
result = 0; /* good */
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
Loading…
Reference in New Issue
Block a user