Commit 3291ed04 authored by Krzysztof Goreczny's avatar Krzysztof Goreczny Committed by Jim Harris
Browse files

sock/posix: unmark socket_has_data also for listening sockets



This is a prework for polling listening sockets via sock groups.
If the socket_has_data flag is not cleared and the socket is not
removed from the group->sockets_with_data then spdk_sock_group_poll()
called on the listening sockets group would forever return all sockets
that ever had received an accept request.

Change-Id: I37b41e5118a557e7cc5f28ada553be3cfb8ee37e
Signed-off-by: default avatarKrzysztof Goreczny <krzysztof.goreczny@dell.com>
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/23212


Community-CI: Mellanox Build Bot
Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarKonrad Sztyber <konrad.sztyber@intel.com>
Reviewed-by: default avatarJim Harris <jim.harris@samsung.com>
Reviewed-by: default avatarBoris Glimcher <Boris.Glimcher@emc.com>
parent 29f02008
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -1118,6 +1118,7 @@ static struct spdk_sock *
_posix_sock_accept(struct spdk_sock *_sock, bool enable_ssl)
{
	struct spdk_posix_sock		*sock = __posix_sock(_sock);
	struct spdk_posix_sock_group_impl *group = __posix_group_impl(sock->base.group_impl);
	struct sockaddr_storage		sa;
	socklen_t			salen;
	int				rc, fd;
@@ -1131,6 +1132,12 @@ _posix_sock_accept(struct spdk_sock *_sock, bool enable_ssl)

	assert(sock != NULL);

	/* epoll_wait will trigger again if there is more than one request */
	if (group && sock->socket_has_data) {
		sock->socket_has_data = false;
		TAILQ_REMOVE(&group->socks_with_data, sock, link);
	}

	rc = accept(sock->fd, (struct sockaddr *)&sa, &salen);

	if (rc == -1) {