[vlc-commits] network: inline net_AcceptSingle()
Rémi Denis-Courmont
git at videolan.org
Sun Nov 11 16:33:29 CET 2018
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri Nov 9 22:52:57 2018 +0200| [d5ad81a50f84d6578038ebbd4d5fcd92e294cae4] | committer: Rémi Denis-Courmont
network: inline net_AcceptSingle()
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d5ad81a50f84d6578038ebbd4d5fcd92e294cae4
---
src/network/io.c | 32 ++++++++++++--------------------
1 file changed, 12 insertions(+), 20 deletions(-)
diff --git a/src/network/io.c b/src/network/io.c
index 6e9097d635..b29febf347 100644
--- a/src/network/io.c
+++ b/src/network/io.c
@@ -340,25 +340,6 @@ void net_ListenClose(int *fds)
}
}
-static int net_AcceptSingle(vlc_object_t *obj, int lfd)
-{
- int fd = vlc_accept(lfd, NULL, NULL, true);
- if (fd == -1)
- {
- if (net_errno != EAGAIN)
-#if (EAGAIN != EWOULDBLOCK)
- if (net_errno != EWOULDBLOCK)
-#endif
- msg_Err(obj, "accept failed (from socket %d): %s", lfd,
- vlc_strerror_c(net_errno));
- return -1;
- }
-
- msg_Dbg(obj, "accepted socket %d (from socket %d)", fd, lfd);
- setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, &(int){ 1 }, sizeof(int));
- return fd;
-}
-
#undef net_Accept
int net_Accept(vlc_object_t *obj, int *fds)
{
@@ -393,10 +374,21 @@ int net_Accept(vlc_object_t *obj, int *fds)
continue;
int sfd = ufd[i].fd;
- int fd = net_AcceptSingle(obj, sfd);
+ int fd = vlc_accept(sfd, NULL, NULL, true);
if (fd == -1)
+ {
+ if (net_errno != EAGAIN)
+#if (EAGAIN != EWOULDBLOCK)
+ if (net_errno != EWOULDBLOCK)
+#endif
+ msg_Err(obj, "accept failed (from socket %d): %s", sfd,
+ vlc_strerror_c(net_errno));
continue;
+ }
+ msg_Dbg(obj, "accepted socket %d (from socket %d)", fd, sfd);
+ setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
+ &(int){ 1 }, sizeof (int));
/*
* Move listening socket to the end to let the others in the
* set a chance next time.
More information about the vlc-commits
mailing list