[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 3/3] net/tcp: Only call grub_get_time_ms when there are sockets t
From: |
Glenn Washburn |
Subject: |
[PATCH 3/3] net/tcp: Only call grub_get_time_ms when there are sockets to potentially retransmit for |
Date: |
Tue, 8 Mar 2022 15:20:20 -0600 |
If there are no TCP sockets, this call to grub_get_time_ms is unneeded. This
prevents a call into the firmware on some platforms.
Signed-off-by: Glenn Washburn <development@efficientek.com>
---
grub-core/net/tcp.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
diff --git a/grub-core/net/tcp.c b/grub-core/net/tcp.c
index e8ad34b84d..75461eb54e 100644
--- a/grub-core/net/tcp.c
+++ b/grub-core/net/tcp.c
@@ -362,8 +362,13 @@ void
grub_net_tcp_retransmit (void)
{
grub_net_tcp_socket_t sock;
- grub_uint64_t ctime = grub_get_time_ms ();
- grub_uint64_t limit_time = ctime - TCP_RETRANSMISSION_TIMEOUT;
+ grub_uint64_t ctime = 0, limit_time = 0;
+
+ if (tcp_sockets)
+ {
+ ctime = grub_get_time_ms ();
+ limit_time = ctime - TCP_RETRANSMISSION_TIMEOUT;
+ }
FOR_TCP_SOCKETS (sock)
{
--
2.27.0