qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Fix a typo that can cause slow socket response on Windows.
@ 2021-01-29 14:31 Hafiz Abid Qadeer
  2021-01-29 15:05 ` Daniel P. Berrangé
  0 siblings, 1 reply; 2+ messages in thread
From: Hafiz Abid Qadeer @ 2021-01-29 14:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Samuel Thibault, Hafiz Abid Qadeer

We observed slow responses on a host forwarded port on Windows. Investigation revealed that qemu_fd_register was being called with fd=-1 and this caused g_poll in qemu_poll_ns timing out. I tracked this behavior to following commit:
748f8f4 slirp: replace qemu_set_nonblock()

@@ -482,7 +483,8 @@ void tcp_connect(struct socket *inso)
         tcp_close(sototcpcb(so)); /* This will sofree() as well */
         return;
     }
-    qemu_set_nonblock(s);
+    slirp_set_nonblock(s);
+    so->slirp->cb->register_poll_fd(so->s);

It seems that calling register_poll_fd with so->s instead of s may be a typo. Changing it back to s solves this issue. The commit 748f8f4 made similar change in tcp_fconnect but I have not touched it.

Signed-off-by: Hafiz Abid Qadeer <abidh@codesourcery.com>
---
 src/tcp_subr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/tcp_subr.c b/src/tcp_subr.c
index a1016d9..1b6d602 100644
--- a/src/tcp_subr.c
+++ b/src/tcp_subr.c
@@ -493,7 +493,7 @@ void tcp_connect(struct socket *inso)
         return;
     }
     slirp_set_nonblock(s);
-    so->slirp->cb->register_poll_fd(so->s, so->slirp->opaque);
+    so->slirp->cb->register_poll_fd(s, so->slirp->opaque);
     slirp_socket_set_fast_reuse(s);
     opt = 1;
     setsockopt(s, SOL_SOCKET, SO_OOBINLINE, &opt, sizeof(int));
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-01-29 15:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-01-29 14:31 [PATCH] Fix a typo that can cause slow socket response on Windows Hafiz Abid Qadeer
2021-01-29 15:05 ` Daniel P. Berrangé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).